14KT Gold Ladies Diamond Ring

Allison Kaufman
The cookie settings on this website are set to 'allow all cookies' to give you the very best experience. Please click Accept Cookies to continue to use the site.
You have successfully subscribed!
This email has been registered
document.addEventListener('DOMContentLoaded', function () { // Check if the customer is logged in and is placing their first order if (Shopify && Shopify.checkout && isFirstOrder()) { applyDiscountCode('1STORDER'); } }); function isFirstOrder() { // You need to implement this function based on your logic to check if it's the first order // For example, you could use local storage, cookies, or a backend call to validate // This is a dummy implementation return !localStorage.getItem('hasOrdered'); } function applyDiscountCode(discountCode) { fetch('/cart.js') .then(response => response.json()) .then(cart => { if (cart && cart.discount_code === null) { fetch('/cart/update.js', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ updates: {}, discount_code: discountCode }) }) .then(response => response.json()) .then(cart => { console.log('Discount code applied:', cart); // Update the UI or inform the user if necessary }); } }); } // Set localStorage after the first order is placed // You might need to call this function after a successful checkout function setFirstOrderFlag() { localStorage.setItem('hasOrdered', 'true'); }