Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dparker1005/b93b6ce74cc77e0688b3af0c7f9d91c1 to your computer and use it in GitHub Desktop.
Save dparker1005/b93b6ce74cc77e0688b3af0c7f9d91c1 to your computer and use it in GitHub Desktop.
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