Created
August 22, 2024 08:12
-
-
Save andrewlimaza/99d595cb6733234e9f67989a9c20b672 to your computer and use it in GitHub Desktop.
Add "is renewal" to PMPro Zapier (plugin) New Order outbound events.
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 | |
/** | |
* Add 'is_renewal' to the data load sent to Zapier when using the New Order trigger for PMPro Zapier Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_add_custom_field_added_order( $data, $order, $user_id ) { | |
if ( $order->is_renewal() ) { | |
$data['is_renewal'] = true; | |
} else { | |
$data['is_renewal'] = false; | |
} | |
// You can add more custom fields here. | |
// $data['custom_field'] = get_user_meta( $user_id, 'custom_field', true ); | |
return $data; | |
} | |
add_filter( 'pmproz_added_order_data', 'my_pmpro_add_custom_field_added_order', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment