While testing PR https://github.com/Automattic/woocommerce-subscriptions-core/pull/367 I found an issue with the Cancel and remove personal data not working on stores with HPOS enabled. This was caused by the new ListTable class handling this bulk action request for Orders as well as subscriptions.
To fix this, we need to introduce a new action name to prevent WooCommerce from handling it automatically. To do this, this PR adds a new action called wcs_remove_personal_data and then handles this action manually using the handle_bulk_actions-woocommerce_page_wc-orders--shop_subscription action hook.
How to test this PR
Enable HPOS on your store.
Purchase multiple subscriptions on the checkout
Go to the Subscriptions list table
Select one or multiple subscriptions and use the Cancel and remove personal data action
Confirm the subscriptions are canceled with all their data removed.
Confirm the admin notice is shown
Run the same checks with HPOS disabled.
Product impact
[x] Added changelog entry. No changelog needed for this PR as we can use the same changelog used for #376
[x] Will this PR affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[x] Will this PR affect WooCommerce Payments? yes/no/tbc, add issue ref
[ ] Added deprecated functions, hooks or classes to the spreadsheet
Fixes #376
Description
While testing PR https://github.com/Automattic/woocommerce-subscriptions-core/pull/367 I found an issue with the Cancel and remove personal data not working on stores with HPOS enabled. This was caused by the new
ListTable
class handling this bulk action request for Orders as well as subscriptions.To fix this, we need to introduce a new action name to prevent WooCommerce from handling it automatically. To do this, this PR adds a new action called
wcs_remove_personal_data
and then handles this action manually using thehandle_bulk_actions-woocommerce_page_wc-orders--shop_subscription
action hook.How to test this PR
Cancel and remove personal data
actionProduct impact