Closed petertwise closed 7 years ago
@squarecandy there are quite a few hooks you can use. You can find them all here https://github.com/Prospress/woocommerce-subscriptions/blob/master/includes/class-wc-subscription.php#L544-L550
The woocommerce_subscription_status_updated
action is triggered on every status change so you would need to check which status the subscription is changing to. The new status is the 2nd argument.
If you only specifically need active to cancelled status transitions you can use the dynamic hook woocommerce_subscription_status_active_to_cancelled
.
Thanks James!
The link above is broken - here's the one I found working in case anyone else stumbles upon this: https://github.com/wp-premium/woocommerce-subscriptions/blob/master/includes/class-wc-subscription.php
do_action( 'woocommerce_subscription_status_' . $this->status_transition['from'] . '_to_' . $this->status_transition['to'], $this );
This is awesome - mirrors the core {old_status}to{new_status} hook nicely.
Anyone know what hook to use to increase an item's stock by one when an active subscription for that item is canceled?