This filter is run during a WooCommerce checkout, after WP Fusion has extracted the customer data from the order object. It can be used to sync additional data from a WooCommerce order to custom fields in your CRM.  To use the code examples below, add them to your active theme’s functions.php file.


  • $order_data: This is an array of key value pairs representing WordPress meta fields and their corresponding values.
  • $order: The WooCommerce order object


Sync the WooCommerce total order value to a custom field

function get_order_total( $order_data, $order ) {

	$order_data['order_total'] = $order->get_total();

	return $order_data;


add_filter( 'wpf_woocommerce_customer_data', 'get_order_total', 10, 2 );

Sync the coupon code used on an order to a custom field

// Add the coupon field as available for sync on the Contact Field tab in the WPF settings

function wpf_coupon_meta_fields( $fields ) {

	$fields['wc_coupon'] = array( 'label' => 'Coupon', 'type' => 'text', 'group' => 'woocommerce' );

	return $fields;


add_filter( 'wpf_meta_fields', 'wpf_coupon_meta_fields' );

// Get the coupon code of the first coupon used on the order and add it to the order data

function wpf_sync_coupon( $order_data, $order ) {

	$coupons = $order->get_coupon_codes();

	if( ! empty( $coupons ) ) {
		$order_data['wc_coupon'] = $coupons[0];

	return $order_data;


add_filter( 'wpf_woocommerce_customer_data', 'wpf_sync_coupon', 10, 2 );