Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active May 9, 2016 05:04
Show Gist options
  • Select an option

  • Save BFTrick/8696222 to your computer and use it in GitHub Desktop.

Select an option

Save BFTrick/8696222 to your computer and use it in GitHub Desktop.
Hooking into the cancelled subscription hook.
<?php
/*
Plugin Name: Cancelled Subscriptions Hook
Plugin URI: https://gist.github.com/BFTrick/8696222
Description: Hook into the WooCommerce Cancelled Subscriptions hook and print the data.
Version: 1.0.0
Author: Patrick Rauland
Author URI: http://www.patrickrauland.com
*/
function my_cancelled_subscription( $user_id, $subscription_key ) {
echo "user_id is: ";
print_r( $user_id );
echo "\r\n";
echo "subscription_key is: ";
print_r( $subscription_key );
exit();
}
add_action( 'cancelled_subscription', 'my_cancelled_subscription', 10, 2 );
user_id is: X subscription_key is: XXXXX_XXXXX
@anhducbkhn

Copy link
Copy Markdown

I use standard paypal, when customer cancel subscription from paypal account, this code is not working. :(.
Other hook work well: add_action('processed_subscription_payment', 'subPay', 10, 2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment