If you are already using the "Facebook For WooCommerce" plugin for your Woocommerce store to track purchase events.
You will require to follow some simple steps to enable "Purchase Events" tracking using FunnelKit.
Follow these instructions:
Step 1: Disable the purchase event tracking
To disable Purchase Events tracking using the "Facebook For WooCommerce" plugin, copy the code snippet from below and paste it into your functions.php file:
/**
* This snippet will stop purchase events to fire on thank you page
**/
add_action( 'woocommerce_init', function () {
//get all WooCommerce integrations
$integrations = WC()->integrations->get_integrations();
//checking if facebook for woocommerce installed?
if ( isset( $integrations['facebookcommerce'] ) && $integrations['facebookcommerce'] instanceof WC_Facebookcommerce_Integration ) {
/**
* For version < 1.1.0
*/
remove_action( 'woocommerce_thankyou', [
$integrations['facebookcommerce']->events_tracker,
'inject_gateway_purchase_event'
], $integrations['facebookcommerce']->events_tracker::FB_PRIORITY_HIGH );
/**
* For version >= 1.1.0
*/
remove_action( 'woocommerce_thankyou', [
$integrations['facebookcommerce']->events_tracker,
'inject_purchase_event'
], 40 );
}else{
if ( function_exists('facebook_for_woocommerce') ) {
$event_track = facebook_for_woocommerce()->get_integration()->events_tracker;
/**
* For version >= 1.1.0
*/
remove_action( 'woocommerce_thankyou', [
$event_track,
'inject_purchase_event'
], 40 );
remove_action( 'woocommerce_checkout_update_order_meta', [
$event_track,
'inject_purchase_event'
], 10 );
}
}
}, 999 );
Step 2: Go to FunnelKit Settings
Now navigate to FunnelKit > Settings > General > Facebook Pixel tab.
Scroll down and click "Enable Purchase Event"
Once done, click on the "Save Changes" button.
Step 3: Ignore the warning message
All Done!! After making all changes, you can ignore the notification by clicking the "Ignore this message" link.
That's done!