Last active
December 15, 2025 12:05
-
-
Save xlplugins/0844e4d35b170493b8442dab4c5d75b0 to your computer and use it in GitHub Desktop.
Cart: Disable JetEngine Listing Overlay Click While Preserving Add to Cart (JetEngine Compatibility Fix) - Crocoblock
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 type="text/javascript"> | |
| (function($){ | |
| /** | |
| * ------------------------------- | |
| * 1. Your cart property logic | |
| * ------------------------------- | |
| */ | |
| window.addEventListener('DOMContentLoaded', function () { | |
| if ( typeof window.fkcart_app_data !== 'undefined' ) { | |
| window.fkcart_app_data.ajax_add_to_cart = 'yes'; | |
| } | |
| }); | |
| /** | |
| * ------------------------------- | |
| * 2. JetEngine overlay override | |
| * ------------------------------- | |
| */ | |
| function overrideJetEngineOverlay() { | |
| // Remove JetEngine's original handler | |
| $(document).off( | |
| 'click.JetEngine', | |
| '.jet-engine-listing-overlay-wrap:not([data-url*="event=hover"])' | |
| ); | |
| // Rebind with safe guard | |
| $(document).on( | |
| 'click.JetEngine', | |
| '.jet-engine-listing-overlay-wrap:not([data-url*="event=hover"])', | |
| function (e) { | |
| // Allow WooCommerce interactions | |
| if ( | |
| $(e.target).closest( | |
| 'form.cart,' + | |
| '.jet-woo-builder,' + | |
| '.single_add_to_cart_button,' + | |
| '.quantity,' + | |
| '.qty,' + | |
| '.plus,' + | |
| '.minus,' + | |
| 'button,' + | |
| 'input,' + | |
| 'select,' + | |
| 'a' | |
| ).length | |
| ) { | |
| return true; | |
| } | |
| // Block JetEngine redirect | |
| e.preventDefault(); | |
| e.stopImmediatePropagation(); | |
| return false; | |
| } | |
| ); | |
| } | |
| /** | |
| * ------------------------------- | |
| * 3. Init + re-init on AJAX | |
| * ------------------------------- | |
| */ | |
| $(document).ready(function () { | |
| overrideJetEngineOverlay(); | |
| }); | |
| $(document).on('jet-filter-content-rendered', function () { | |
| overrideJetEngineOverlay(); | |
| }); | |
| })(jQuery); | |
| </script> | |
| <?php | |
| }, 999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment