Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewlimaza/99d595cb6733234e9f67989a9c20b672 to your computer and use it in GitHub Desktop.
Save andrewlimaza/99d595cb6733234e9f67989a9c20b672 to your computer and use it in GitHub Desktop.
Add "is renewal" to PMPro Zapier (plugin) New Order outbound events.
<?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