When you use the bulk or row actions on the WooCommerce > Subscriptions list table to trash,untrash (restore) or delete subscriptions, the subscription specific hooks - eg woocommerce_trash_subscription - don't fire.
This is caused the way WC core handles these bulk actions.
In the Automattic\WooCommerce\Internal\Admin\Orders\ListTable WC core specifically gets the order data store code ref and calls the delete function on that, which means when you delete a subscription, order hooks are fired instead.
To Reproduce
Hook onto a hook like woocommerce_trash_subscription and error log or add a breakpoint.
Enable HPOS
Go to WooCommerce > Subscriptions.
Select a subscription
From the drop down select "Move to trash"
Click apply.
Note that the woocommerce_trash_subscription hook doesn't fire.
This applies to permanently deleting, trashing and untrashing.
Expected behavior
The subscription datastore functions to trash/delete subscriptions should be called over the order data store.
Actual behavior
The order datastore functions are being called instead, meaning order trash hooks are firing instead.
Product impact
[ ] Does this issue affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[ ] Does this issue affect WooCommerce Payments? yes/no/tbc, add issue ref
Describe the bug
When you use the bulk or row actions on the WooCommerce > Subscriptions list table to trash,untrash (restore) or delete subscriptions, the subscription specific hooks - eg
woocommerce_trash_subscription
- don't fire.This is caused the way WC core handles these bulk actions.
In the
Automattic\WooCommerce\Internal\Admin\Orders\ListTable
WC core specifically gets the order data store code ref and calls the delete function on that, which means when you delete a subscription, order hooks are fired instead.To Reproduce
woocommerce_trash_subscription
and error log or add a breakpoint.woocommerce_trash_subscription
hook doesn't fire.This applies to permanently deleting, trashing and untrashing.
Expected behavior
The subscription datastore functions to trash/delete subscriptions should be called over the order data store.
Actual behavior
The order datastore functions are being called instead, meaning order trash hooks are firing instead.
Product impact
Additional context