or a GTM * Custom HTML tag firing on all pages). Remove once the developers ship a fix. */ (function () { var KEY = 'hgSuppressQuickCart'; var GUARD = 'hg-suppress-quickcart'; if (window[KEY]) return; // don't run twice window[KEY] = true; // (a) CSS guard: hide the drawer while suppressing, so there is no flash. var style = document.createElement('style'); style.textContent = 'html.' + GUARD + ' #store_quick_cart_widget{display:none !important;}'; (document.head || document.documentElement).appendChild(style); document.documentElement.classList.add(GUARD); var suppressing = true; function forceClose() { document.body.classList.remove('sc_quick_cart_widget_active', 'sc_quick_cart_widget_animate'); var w = document.getElementById('store_quick_cart_widget'); if (w) w.classList.remove('active', 'animate'); } function stop() { suppressing = false; document.documentElement.classList.remove(GUARD); try { observer.disconnect(); } catch (e) {} } // (b) Watch for the drawer being opened while we're still suppressing. var observer = new MutationObserver(function () { if (suppressing && document.body.classList.contains('sc_quick_cart_widget_active')) { forceClose(); } }); function arm() { observer.observe(document.body, { attributes: true, attributeFilter: ['class'] }); forceClose(); // in case it opened before this ran } if (document.body) arm(); else document.addEventListener('DOMContentLoaded', arm); // First genuine interaction = real visit; stop suppressing so the basket // works normally from here on (add-to-cart, manual open, etc.). ['pointerdown', 'keydown', 'touchstart'].forEach(function (ev) { document.addEventListener(ev, stop, { capture: true, once: true }); }); // Safety backstop: never interfere for longer than 15s. setTimeout(stop, 15000); })();
Cookies allow us to provide you with useful features and to measure performance in order to improve your experience. By clicking 'Accept all', you agree to the use of all cookies. By clicking 'Manage Cookies', you only agree to the use of selected cookie categories. For more information, see our Privacy Policy.