Created
September 29, 2020 04:44
-
-
Save gausam/6c6726c8d06c08787eb8681cd3d3b774 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