(function () { const OLD_TEXT = "The store cannot ship one or more of the items in your cart."; const NEW_TEXT = "Thanks for your order enquiry! A member of our sales team will be in touch soon to help with branding, payment, and courier/ collection arrangements."; function replaceAlerts(root = document.body) { root.querySelectorAll(".alert").forEach((el) => { if (el.textContent.includes(OLD_TEXT)) { el.textContent = el.textContent.replace(OLD_TEXT, NEW_TEXT); } }); } // Run once on load document.addEventListener("DOMContentLoaded", () => replaceAlerts()); // Watch for alerts added later (e.g. after an AJAX cart update) const observer = new MutationObserver(() => replaceAlerts()); observer.observe(document.body, { childList: true, subtree: true }); })();