Created
March 13, 2026 15:00
-
-
Save xlplugins/6d5cdfd7815622657692f4fc7b7d3cac to your computer and use it in GitHub Desktop.
Reload issue with slide cart
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_enqueue_scripts', function() { | |
| if ( ! apply_filters( 'fkcart_prevent_cart_reload', true ) ) { | |
| return; | |
| } | |
| if ( is_cart() ) { | |
| return; | |
| } | |
| $inline = <<<'JS' | |
| (function($){ | |
| $(document).on('added_to_cart.wc-cart wc_update_cart.wc-cart', function(e){ | |
| if (!$('.woocommerce-cart-form').length) { | |
| e.stopImmediatePropagation(); | |
| } | |
| }); | |
| })(jQuery); | |
| JS; | |
| wp_add_inline_script( 'jquery', $inline, 'after' ); | |
| }, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment