Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamarazuk/80b6920e8de169b6e021d19898a9cd68 to your computer and use it in GitHub Desktop.
Save tamarazuk/80b6920e8de169b6e021d19898a9cd68 to your computer and use it in GitHub Desktop.
Facebook for WooCommerce: Track AddToCart event on Basel theme
<?php // only copy this line if needed
function sv_facebook_for_wc_basel_theme_add_filter_for_add_to_cart_fragments() {
// only make changes as long as Facebook for WooCommerce is installed
if ( function_exists( 'facebook_for_woocommerce' ) ) {
$events_tracker = facebook_for_woocommerce()->get_integration()->events_tracker;
$events_tracker->add_filter_for_conditional_add_to_cart_fragment();
}
}
add_action( 'wp_ajax_nopriv_basel_ajax_add_to_cart', 'sv_facebook_for_wc_basel_theme_add_filter_for_add_to_cart_fragments' );
add_action( 'wp_ajax_basel_ajax_add_to_cart', 'sv_facebook_for_wc_basel_theme_add_filter_for_add_to_cart_fragments' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment