#Overview
This filter is run during a WooCommerce checkout, while WP Fusion is preparing to sync FooEvents event attendees to your CRM. It can be used to modify the data that is synced for each attendee.
To use the code examples below, add them to your active theme’s functions.php file.
#Parameters
$update_data
: (array) This is an array of key value pairs representing WordPress meta fields and their corresponding values.$attendee
: (array) The FooEvents attendee data.$order_id
: (int) The WooCommerce order ID
#Examples
#Sync event dates in separate fields
This example syncs the event date in a separate field, identified by the event ID (like event_date_123
).
It can be used to store event dates in multiple custom CRM fields when a customer registers for multiple events simultaneously.
function sync_booking_dates( $update_data, $attendee, $order_id ) {
$product_id = $attendee['WooCommerceEventsProductID'];
$update_data[ 'event_date_' . $product_id ] = get_post_meta( $product_id, 'WooCommerceEventsDate', true );
return $update_data;
}
add_action( 'wpf_woocommerce_attendee_data', 'sync_booking_dates', 10, 3 );
Please note that to sync the data with your CRM, you will still need to manually create a custom field mapping at the bottom of the Contact Fields list in the WP Fusion settings.
So, for example, if your product ID was 123, you would manually add a new field for event_date_123
, set the type to date
, and then choose the corresponding custom field in your CRM from the dropdown at the right.