/* Add custom Js code below */ // Define a unique ID for the button element const buttonId = 'whatsapp-fixed-button'; // Function to check and hide the button if the current page is the Cart page function checkAndHideButton() { const currentPath = window.location.pathname.toLowerCase(); const button = document.getElementById(buttonId); if (button && (currentPath === '/cart' || currentPath === '/cart/')) { button.style.display = 'none'; } else if (button) { button.style.display = 'flex'; } } // --- REST OF YOUR ORIGINAL SCRIPT --- const contactBtn = document.createElement('div'); contactBtn.id = buttonId; const prefilled = encodeURIComponent("السلام عليكم، لدي استفسار بخصوص قطعة غيار."); const waLink = `https://wa.me/966592499658?text=${prefilled}`; function getBottomOffset() { const width = window.innerWidth; if (width <= 480) return '120px'; if (width <= 768) return '100px'; return '20px'; } contactBtn.innerHTML = ` واتساب هل لديك أي استفسار؟ `; document.body.appendChild(contactBtn); window.addEventListener('resize', () => { const link = contactBtn.querySelector('.whatsapp-tracker-link'); link.style.bottom = getBottomOffset(); }); window.addEventListener('load', checkAndHideButton); setTimeout(checkAndHideButton, 50);