Skip to content

Instantly share code, notes, and snippets.

@NickGreen
Created January 2, 2019 19:09
Show Gist options
  • Save NickGreen/4c9cd8f7a6d2f8971e6cad7ef510b43d to your computer and use it in GitHub Desktop.
Save NickGreen/4c9cd8f7a6d2f8971e6cad7ef510b43d to your computer and use it in GitHub Desktop.
Run code when sub status changes to pending cancel
<?php
add_action('woocommerce_subscription_status_updated', 'test_func', 100, 3);
function test_func($subscription, $new_status, $old_status) {
if( 'pending-cancel' == $new_status ) {
error_log( 'In ' . __FUNCTION__ . '(), status changed to = ' . var_export( $new_status, true ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment