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 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025