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
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024