Created
December 1, 2025 11:13
-
-
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
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
| 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