const fetchPopups = () => { fetch("https://api.smsbump.com/v2/formsPublic/getFormsScripts", { method: "POST", mode: "cors", body: JSON.stringify({ shop: window.Shopify.shop }), }).then(response => response.json()) .then((response) => { response?.forms_scripts?.forEach((script) => { let scriptElement = document.createElement("script"); scriptElement.type = "text/javascript"; scriptElement.src = script; document.head.appendChild(scriptElement); }) }) } fetchPopups();