Created
July 15, 2021 18:30
-
-
Save dparker1005/b93b6ce74cc77e0688b3af0c7f9d91c1 to your computer and use it in GitHub Desktop.
Sends the discount code used to Zapier on the After Checkout trigger.
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 | |
// Copy from below here... | |
/** | |
* Sends the discount code used to Zapier on the After Checkout trigger. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmproz_after_checkout_data_discount_code( $data, $user_id, $level, $order ) { | |
$discount_code = $order->getDiscountCode( true ); | |
$data['discount_code'] = empty( $discount_code->code ) ? '' : $discount_code->code; | |
return $data; | |
} | |
add_filter( 'pmproz_after_checkout_data', 'my_pmproz_after_checkout_data_discount_code', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment