Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello, can you help me please by triggerin that 3 options with marketing, analytics and functions to be auto checked when somebody press accept for cookie?
I did a code with chatgpt but i dont know if it is correct and I dont know where should i put it
document.addEventListener('DOMContentLoaded', function () { const observer = new MutationObserver(function (mutations, me) { const bannerDialog = document.querySelector('.shopify-pc__banner__dialog'); if (bannerDialog) { const cookiePreferences = bannerDialog.querySelectorAll('input[type="checkbox"]'); cookiePreferences.forEach(function (checkbox) { if (!checkbox.checked) { checkbox.click(); } }); const acceptButton = bannerDialog.querySelector('button.shopify-pc__banner__btn-accept'); if (acceptButton) { acceptButton.click(); } me.disconnect(); } }); observer.observe(document, { childList: true, subtree: true }); });
hey
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024