Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created December 1, 2025 11:13
Show Gist options
  • Select an option

  • Save xlplugins/774beda614d6c1b2b9facb8529f9b3a7 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/774beda614d6c1b2b9facb8529f9b3a7 to your computer and use it in GitHub Desktop.
Funnelkit Cart: Auto-open Funnel Kit cart when BodyCommerce AJAX add to cart completes
add_action( 'wp_footer', function () {
?>
<script>
jQuery(function($) {
$(document).ajaxComplete(function(event, jqxhr, settings) {
// Check in settings.data (POST data) for the action
if (settings && settings.data &&
settings.data.indexOf('action=bodycommerce_ajax_add_to_cart_woo') > -1 &&
jqxhr.status === 200) {
// Optional: Debug in console
console.log('BodyCommerce: Opening cart after add to cart');
// Trigger cart to open
$('body').trigger('fkcart_open');
}
});
});
</script>
<?php
}, 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment