Last active
July 2, 2020 17:40
-
-
Save deivamagalhaes/36c659c0603e44b3633ef79146274c85 to your computer and use it in GitHub Desktop.
Track AddToCart event on Basel theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sv_add_filter_for_conditional_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_add_filter_for_conditional_add_to_cart_fragments' ); | |
add_action( 'wp_ajax_basel_ajax_add_to_cart', 'sv_add_filter_for_conditional_add_to_cart_fragments' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment