Automattic / woocommerce-subscriptions-core

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

[HPOS] Missing warning when deleting a subscription parent order #500

Open a-danae opened 1 year ago

a-danae commented 1 year ago

Describe the bug

With HPOS enabled, no warning is shown when deleting a subscription parent order. This warning is shown when HPOS is disabled.

To Reproduce

  1. Go to WooCommerce -> Settings -> Advanced -> Features. /wp-admin/admin.php?page=wc-settings&tab=advanced&section=features
  2. Under Experimental features, select "High performance order storage (new)", enable "Keep the posts and orders tables in sync (compatibility mode)", and save
  3. As a shopper, purchase a subscription if you don't have one already purchased
  4. Go to WooCommerce -> Orders. /wp-admin/admin.php?page=wc-orders
  5. Check off the checkbox for the parent order of the subscription -> Select "Move to trash" in bulk actions -> Click on "Apply"
  6. Notice the order is moved to trash. Instead, an alert dialog should show up (see the video under "Expected behavior" below)

Expected behavior

I'd expect the warning to appear when deleting a subscription parent order. Just as it's shown when HPOS is disabled: https://github.com/Automattic/woocommerce-subscriptions-core/assets/41606954/da274b8d-c04a-435c-9a7e-5643b6e5b5f6

Actual behavior

The order is moved to the trash with no warning.

https://github.com/Automattic/woocommerce-subscriptions-core/assets/41606954/466b2d87-cee2-4177-9708-e8edde606854

Product impact

Additional context

This is related to the WC_Subscriptions_Order::add_contains_subscription_hidden_field method. It's hooked to the manage_shop_order_posts_custom_column action which doesn't run for HPOS. It should probably be hooked to the woocommerce_shop_order_list_table_custom_column hook for HPOS.