Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
87 stars 33 forks source link

Untrashing subscription parent order does not make subscription re-appear on My Account > Subscriptions page #385

Open shendy-a8c opened 1 year ago

shendy-a8c commented 1 year ago

Describe the bug

Untrashing subscription parent order does not make subscription re-appear on My Account > Subscriptions page. This problem happens when HPOS is disabled or when HPOS is enabled but the authoritative order table is set to be the posts table.

I think the problem is within WCS_Post_Meta_Cache_Manager. I did a quick step-through from WCS_Post_Meta_Cache_Manager::post_untrashed() and found out somehow is_change_to_ignore() returns true, so trigger_update_cache_hook() is never called. Hence, cache isn't updated.

To Reproduce

  1. Purchase a subscription.
  2. Make sure the subscription appears on My Account > Subscriptions page.
  3. Trash the subscription's parent order.
  4. Make sure the subscription disappears from My Account > Subscriptions page.
  5. Restore / untrash the subscription's parent order.

Expected behavior

Subscription should re-appear on My Account > Subscriptions page.

Actual behavior

Subscription is missing from My Account > Subscriptions page.

Product impact

Additional context

This bug was discovered when I was working on https://github.com/Automattic/woocommerce-subscriptions-core/pull/383.

haszari commented 1 year ago

@shendy-a8c is this issue related to (part of) HPOS project or is it unrelated? I've tagged as project HPOS, let me know if we should handle as maintenance instead (e.g. existing issue). FYI @mattallan

shendy-a8c commented 1 year ago

This issue was discovered during HPOS work but not specifically HPOS related. It is an existing issue and I think should be handled as a maintenance issue.