Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sends the discount code used to Zapier on the After Checkout trigger.
<?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