Created
November 4, 2020 12:00
-
-
Save yanknudtskov/7370b2ed9ec337dce8c8ca2cd1299ade to your computer and use it in GitHub Desktop.
WooCommerce Subscriptions: Also send Subscription Cancelled email to customer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('woocommerce_subscription_status_pending-cancel', 'yanco_woocommerce_subscription_status_pending_cancel', 10, 3 ); | |
function yanco_woocommerce_subscription_status_pending_cancel( $subscription ) { | |
$customer_email = $subscription->get_billing_email(); | |
$wc_emails = WC()->mailer()->get_emails(); | |
$admin_email = $wc_emails['WCS_Email_Cancelled_Subscription']->recipient; | |
$wc_emails['WCS_Email_Cancelled_Subscription']->trigger( $subscription ); | |
$wc_emails['WCS_Email_Cancelled_Subscription']->recipient = $customer_email; | |
$wc_emails['WCS_Email_Cancelled_Subscription']->trigger( $subscription ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment