Created
April 16, 2026 12:27
-
-
Save xlplugins/8ee29c50bf8a2dfe3d619f5c5bba1b1c to your computer and use it in GitHub Desktop.
Simple Sticky Add To Cart For WooCommerce conflict with fkcart
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 () { | |
| if ( ! is_product() ) { | |
| return; | |
| } | |
| ?> | |
| <script> | |
| document.addEventListener('click', function (e) { | |
| var a = e.target.closest('a.wsatc-add-to-cart'); | |
| var wrap = document.getElementById('wsatc-stick-cart-wrapper'); | |
| if (!a || !wrap || !wrap.classList.contains('simple')) { | |
| return; | |
| } | |
| e.preventDefault(); | |
| var wsQty = document.querySelector('.wsatc-qty-field'); | |
| var formQty = document.querySelector('form.cart .qty'); | |
| if (wsQty && formQty) { | |
| formQty.value = wsQty.value; | |
| } | |
| var btn = document.querySelector('form.cart .single_add_to_cart_button'); | |
| if (btn) { | |
| btn.click(); | |
| } | |
| }, true); | |
| </script> | |
| <?php | |
| }, 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment