-
-
Save MaryOJob/ae4f77de6ca46429a0c83f45afc3288e to your computer and use it in GitHub Desktop.
Adds extra checkout data to the Zapier Add On's after_checkout_data trigger payload.
This file contains hidden or 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 | |
/** | |
* This recipe adds extra checkout data to the Zapier Add On's after_checkout_data trigger payload. | |
* | |
* It is intended for use with the Zapier Integration Add On: | |
* https://www.paidmembershipspro.com/add-ons/pmpro-zapier/ | |
* | |
* 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 mypmproz_after_checkout_data($data, $user_id, $level, $order ) { | |
// fetch the additional register helper values from meta | |
$field1 = get_user_meta($user_id, 'NAME_OF_CUSTOM_FIELD', true); | |
$field2 = get_user_meta($user_id, 'NAME_OF_SECOND_CUSTOM_FIELD', true); | |
// add them to the $data payload | |
$data['field1'] = $field1; | |
$data['field2'] = $field2; | |
// return modified payload | |
return $data; | |
} | |
add_filters( 'pmproz_after_checkout_data', 'mypmproz_after_checkout_data', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment