Skip to content
  • Home
  • iPhone
    • Image All iPhones
    • Image iPhone 13
    • Image iPhone 14
    • Image iPhone 15
    • Image iPhone 16
    • Image iPhone 17
  • iPad
    • Image All iPads
    • Image iPad Pro
  • Macbook
    • Image All Macbooks
    • Image MacBook Pro
    • Image MacBook Air
  • Accessories
    • Image All Accessories
    • Image Case Cover Combo
    • Image Adapter
    • Image Powerbanks
    • Image Cable
  • Wearables
    • Image All Wearables
    • Image Watch
    • Image Earphones
  • News
Log in
  • X (Twitter)
  • X (Twitter)
  • Facebook
  • Instagram
Maple Store
  • Home
  • iPhone
    • Image All iPhones
    • Image iPhone 13
    • Image iPhone 14
    • Image iPhone 15
    • Image iPhone 16
    • Image iPhone 17
  • iPad
    • Image All iPads
    • Image iPad Pro
  • Macbook
    • Image All Macbooks
    • Image MacBook Pro
    • Image MacBook Air
  • Accessories
    • Image All Accessories
    • Image Case Cover Combo
    • Image Adapter
    • Image Powerbanks
    • Image Cable
  • Wearables
    • Image All Wearables
    • Image Watch
    • Image Earphones
  • News

Trending Searches

Image
Cart
Log in
✕
Your Logo Here

Login now to unlock
exclusive offers

Login now to unlock exclusive offers

  • Faster checkout
  • Exclusive offers
  • No passwords required

Sign In Instantly with Mobile or Social

Enter mobile number or continue with Google

+91
Enter a valid phone number.

Or Continue With
Back

Sign up and unlock your personalized experience.

Firstly You have to register yourself.
Resend OTP

Back

We’ve Sent You a Code β€” Verify It! πŸ”

Verification code sent to +91

01:00 resend OTP

Home

Search results

1000 results

Filter:

Remove all
Availability (0)
Availability
Price
The highest price is β‚Ή 149,999
149,999
β‚Ή
Color (0)
Color
Size (0)
Size
Condition (0)
Condition
Model (0)
Model
Filter and sort Filter

Filter and sort

Filter

1000 results

Availability
Clear
Price

The highest price is β‚Ή 149,999

149,999
β‚Ή
β‚Ή
Clear
Color
Clear
Size
Clear
Condition
Clear
Model
Clear
Remove all
Remove all

1000 results

  • iPhone 16 - 128GB - Teal - Pre-owned

    iPhone 16 - 128GB - Teal - Pre-owned

    iPhone 16 - 128GB - Teal - Pre-owned

    Use code "DOTM2000"

    β‚Ή
    Regular price β‚Ή 57,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 57,999
    You save β‚Ή 31,901
    Sale
  • iPhone 16 -256GB-Teal-Pre-owned

    iPhone 16 -256GB-Teal-Pre-owned

    iPhone 16 -256GB-Teal-Pre-owned

    Use code "DOTM2000"

    β‚Ή
    Regular price β‚Ή 60,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 60,999
    You save β‚Ή 28,901
    Sale
  • iPhone 16 - 256GB - White - Pre-owned

    iPhone 16 - 256GB - White - Pre-owned

    iPhone 16 - 256GB - White - Pre-owned

    β‚Ή
    Regular price β‚Ή 58,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 58,999
    You save β‚Ή 30,901
    Sale
  • iPhone 16 - 128GB - Teal - IW (05-July-26) - Pre-owned

    iPhone 16 - 128GB - Teal - IW (05-July-26) - Pre-owned

    iPhone 16 - 128GB - Teal - IW (05-Jul...

    Use code "DOTM2000"

    β‚Ή
    Regular price β‚Ή 63,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 63,999
    You save β‚Ή 25,901
    Sale
  • iPhone 16 - 128GB - Teal - Pre-owned

    iPhone 16 - 128GB - Teal - Pre-owned

    iPhone 16 - 128GB - Teal - Pre-owned

    β‚Ή
    Regular price β‚Ή 57,999
    Regular price β‚Ή 79,900 Sale price β‚Ή 57,999
    You save β‚Ή 21,901
    Sale
  • iPhone 16 Plus - 128GB - White - Pre-owned

    iPhone 16 Plus - 128GB - White - Pre-owned

    iPhone 16 Plus - 128GB - White - Pre-...

    Use code "DOTM2000"

    β‚Ή
    Regular price β‚Ή 64,999
    Regular price β‚Ή 99,900 Sale price β‚Ή 64,999
    You save β‚Ή 34,901
    Sale
  • iPhone 16 Plus - 128GB - Teal - IW (25-Jul-26) - Pre-owned

    iPhone 16 Plus - 128GB - Teal - IW (25-Jul-26) - Pre-owned

    iPhone 16 Plus - 128GB - Teal - IW (2...

    β‚Ή
    Regular price β‚Ή 66,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 66,999
    You save β‚Ή 22,901
    Sale
  • iPhone 16 Pro - 256GB - Desert Titanium - Pre-owned

    iPhone 16 Pro - 256GB - Desert Titanium - Pre-owned

    iPhone 16 Pro - 256GB - Desert Titani...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 89,999
    Regular price β‚Ή 119,900 Sale price β‚Ή 89,999
    You save β‚Ή 29,901
    Sale
  • iPhone 16 Pro Max -256GB-Natural Titanium-Pre-owned

    iPhone 16 Pro Max -256GB-Natural Titanium-Pre-owned

    iPhone 16 Pro Max -256GB-Natural Tita...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 109,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 109,999
    You save β‚Ή 34,901
    Sale
  • iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-o...

    Use code "DOTM2000"

    β‚Ή
    Regular price β‚Ή 61,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 61,999
    You save β‚Ή 27,901
    Sale
  • iPhone 16 Pro-128GB -Black Titanium-Pre-owned

    iPhone 16 Pro-128GB -Black Titanium-Pre-owned

    iPhone 16 Pro-128GB -Black Titanium-P...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 85,999
    Regular price β‚Ή 109,900 Sale price β‚Ή 85,999
    You save β‚Ή 23,901
    Sale
  • iPhone 16 - 256GB - Teal - Pre-owned

    iPhone 16 - 256GB - Teal - Pre-owned

    iPhone 16 - 256GB - Teal - Pre-owned

    β‚Ή
    Regular price β‚Ή 58,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 58,999
    You save β‚Ή 30,901
    Sale
  • iPhone 16 - 128GB - Pink - IW (25-May-26) - Pre-owned

    iPhone 16 - 128GB - Pink - IW (25-May-26) - Pre-owned

    iPhone 16 - 128GB - Pink - IW (25-May...

    β‚Ή
    Regular price β‚Ή 55,999
    Regular price β‚Ή 79,900 Sale price β‚Ή 55,999
    You save β‚Ή 23,901
    Sale
  • iPhone 16 Pro Max - 256GB - Desert Titanium - IW (14-Feb-26) - Pre-owned

    iPhone 16 Pro Max - 256GB - Desert Titanium - IW (14-Feb-26) - Pre-owned

    iPhone 16 Pro Max - 256GB - Desert Ti...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 113,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 113,999
    You save β‚Ή 30,901
    Sale
  • iPhone 16 Pro-128GB-Natural Titanium-Pre-owned

    iPhone 16 Pro-128GB-Natural Titanium-Pre-owned

    iPhone 16 Pro-128GB-Natural Titanium-...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 85,999
    Regular price β‚Ή 109,900 Sale price β‚Ή 85,999
    You save β‚Ή 23,901
    Sale
  • iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-o...

    β‚Ή
    Regular price β‚Ή 61,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 61,999
    You save β‚Ή 27,901
    Sale
  • iPhone 16 Plus - 128GB - White - IW (25-Jun-26) - Pre-owned

    iPhone 16 Plus - 128GB - White - IW (25-Jun-26) - Pre-owned

    iPhone 16 Plus - 128GB - White - IW (...

    β‚Ή
    Regular price β‚Ή 66,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 66,999
    You save β‚Ή 22,901
    Sale
  • iPhone 16 Pro Max - 256GB - Natural Titanium - IW (10-Jun-26) - Pre-owned

    iPhone 16 Pro Max - 256GB - Natural Titanium - IW (10-Jun-26) - Pre-owned

    iPhone 16 Pro Max - 256GB - Natural T...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 109,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 109,999
    You save β‚Ή 34,901
    Sale
  • iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-owned

    iPhone 16 Plus - 128GB - Teal - Pre-o...

    β‚Ή
    Regular price β‚Ή 66,999
    Regular price β‚Ή 89,900 Sale price β‚Ή 66,999
    You save β‚Ή 22,901
    Sale
  • iPhone 16 Pro Max - 256GB - Desert Titanium - IW (14-Feb-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - Desert Titanium - IW (14-Feb-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - Desert Ti...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 113,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 113,999
    You save β‚Ή 30,901
    Sale
  • iPhone 16 Pro - 256GB - Black Titanium - AC+ (19-Sep-26) - Pre-owned

    iPhone 16 Pro - 256GB - Black Titanium - AC+ (19-Sep-26) - Pre-owned

    iPhone 16 Pro - 256GB - Black Titaniu...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 89,999
    Regular price β‚Ή 119,900 Sale price β‚Ή 89,999
    You save β‚Ή 29,901
    Sale
  • iPhone 16 Pro Max - 256GB - Natural Titanium - IW (03-Mar-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - Natural Titanium - IW (03-Mar-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - Natural T...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 113,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 113,999
    You save β‚Ή 30,901
    Sale
  • iPhone 16 Pro - 128GB - Desert Titanium - IW (13-Feb-26) - Pre-owned

    iPhone 16 Pro - 128GB - Desert Titanium - IW (13-Feb-26) - Pre-owned

    iPhone 16 Pro - 128GB - Desert Titani...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 88,999
    Regular price β‚Ή 109,900 Sale price β‚Ή 88,999
    You save β‚Ή 20,901
    Sale
  • iPhone 16 Pro Max - 256GB - White Titanium - IW (09-Feb-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - White Titanium - IW (09-Feb-26) - Pre-Owned

    iPhone 16 Pro Max - 256GB - White Tit...

    Use code "FLAT5"

    β‚Ή
    Regular price β‚Ή 109,999
    Regular price β‚Ή 144,900 Sale price β‚Ή 109,999
    You save β‚Ή 34,901
    Sale
  • 1
  • 2
  • 3
  • …
  • 42
Image
Corporate Address

Maple DTI, 8th Floor, ABM House, Linking Road (Next to Shoppers Stop), Bandra West, Mumbai 400050.

Follow Us
  • Facebook
  • X (Twitter)
  • Instagram
  • X (Twitter)
Image
Corporate Address

Maple DTI, 8th Floor, ABM House, Linking Road (Next to Shoppers Stop), Bandra West, Mumbai 400050.

Follow Us
  • Facebook
  • X (Twitter)
  • Instagram
  • X (Twitter)

Customer Support

  • FAQs
  • Return Policy
  • Shipping & Delivery Policy
  • My Account

Policies & Legal

  • Privacy Policy
  • Disclaimer Policy
  • Security
  • Terms & Conditions
  • E-commerce Policies
  • Warranty Policy

About Us

  • Our Story
  • Contact Us

Sign Up For Email

Sign up to get first dibs on new arrivals, sales, exclusive content, events, and more!

Payment methods
    © 2026, Maple Store
    • Privacy policy
    • Refund policy
    • Terms of service
    • Shipping policy
    • Contact information
    • Choosing a selection results in a full page refresh.
    • Opens in a new window.
    ' ); iframeDoc.close(); codkLog("βœ… Svelte app initialized and loading in background"); codkLog("πŸ”— JS URL: " + SVELTE_JS_URL); } catch (error) { codkLog("❌ ERROR initializing Svelte:", error); } }; window.codkReinitSvelteIframe = function() { var f = document.getElementById('codk-full-modal-svelte'); if (!f || !f.contentWindow) return; window.codkSvelteAppMounted = false; var cacheBust = '_ri=' + Date.now(); try { var doc = f.contentWindow.document; doc.open(); var bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; var htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; var SVELTE_JS_URL = "https://cdn.shopify.com/s/files/1/0743/3119/3628/files/svellte_production_js.js?v=1780136295"; var SVELTE_CSS_URL = "https://cdn.shopify.com/s/files/1/0743/3119/3628/files/svelte_production_css.css?v=1780136286"; var jsSep = SVELTE_JS_URL.indexOf('?') === -1 ? '?' : '&'; var cssSep = SVELTE_CSS_URL.indexOf('?') === -1 ? '?' : '&'; doc.write('COD King OTP<\/head>
    <\/div><\/scr' + 'ipt><\/body><\/html>'); doc.close(); codkLog("βœ… Iframe reinitialized - Svelte script reloading (cache-bust: " + cacheBust + ")"); } catch (e) { codkLog("❌ Error reinitializing iframe:", e); } }; codkLog("πŸš€ Pre-loading Svelte app on page load..."); initializeSvelteApp(); } window.addEventListener('codking-svelte-ready', () => { codkLog("βœ… Svelte app is ready!"); }); if (!window.__codkPageshowListenerAdded) { window.__codkPageshowListenerAdded = true; window.addEventListener('pageshow', function(event) { if (!event.persisted) return; codkLog("πŸ”„ Page restored from bfcache - checking Svelte status..."); document.body.style.overflow = ''; document.body.style.position = ''; document.body.style.width = ''; document.body.style.top = ''; var currentIframe = document.getElementById('codk-full-modal-svelte'); var svelteWorking = false; try { svelteWorking = currentIframe && currentIframe.contentWindow && currentIframe.contentWindow.appStore && window.codkingSvelteReady; } catch (e) {} if (svelteWorking) { codkLog("βœ… Svelte still functional after bfcache restore"); hideIframe(currentIframe); return; } codkLog("⚠️ Svelte not functional after bfcache restore - performing full reinit..."); if (currentIframe && currentIframe.parentNode) { currentIframe.parentNode.removeChild(currentIframe); } iframe = null; window.codkSvelteInitialized = false; window.codkingSvelteReady = false; window.codkSvelteAppMounted = false; window.codkModalShowingSpinner = false; window.codkOtpModalOpen = false; iframe = ensureIframe(); try { var iframeDoc = iframe.contentWindow.document; var cacheBust = '_bfc=' + Date.now(); var bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; var htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; window.codkSvelteAppMounted = false; iframeDoc.open(); iframeDoc.write( '' + '' + 'COD King OTP' + '' + '
    ' + '<\/scr' + 'ipt>' + '' ); iframeDoc.close(); window.codkSvelteInitialized = true; codkLog("βœ… Fresh Svelte initialization triggered after bfcache restore (cache-bust: " + cacheBust + ")"); } catch (e) { codkLog("❌ Error during bfcache Svelte reinit:", e); } }); } let resizeTimeout; window.addEventListener('resize', () => { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(() => { const iframe = document.getElementById('codk-full-modal-svelte'); if (iframe && iframe.getAttribute('data-visible') === 'true') { const mobile = isMobile(); if (mobile) { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = '100%'; iframe.contentWindow.document.body.style.height = '100vh'; } } catch (e) { } } else { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = 'auto'; iframe.contentWindow.document.documentElement.style.minHeight = '100%'; iframe.contentWindow.document.body.style.height = 'auto'; iframe.contentWindow.document.body.style.minHeight = '100%'; } } catch (e) { } } codkLog("βœ… Iframe document styles updated on resize", { isMobile: mobile, viewportWidth: window.innerWidth }); } }, 150); }); codkLog("πŸ”΅ TDD Phase 1: Adding button blocking..."); const showSpinner = function() { iframe = iframe || document.getElementById('codk-full-modal-svelte'); if (!iframe) { codkLog("❌ Iframe missing when trying to show spinner. Reinitializing..."); window.codkSvelteInitialized = false; if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } return; } if (!iframe.contentWindow || !iframe.contentWindow.document) { codkLog("⚠️ Iframe document unavailable. Reinitializing..."); window.codkSvelteInitialized = false; if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } return; } codkLog("πŸ”΅ TDD Phase 2: Showing spinner (Svelte already loading in background)..."); window.codkModalShowingSpinner = true; window.codkSvelteAppMounted = false; const iframeDoc = iframe.contentWindow.document; const appDiv = iframeDoc.getElementById('app'); if (appDiv) { appDiv.innerHTML = '' + '
    ' + '' + '
    ' + '
    Loading...
    ' + '
    '; codkLog("βœ… Spinner injected into #app (Svelte keeps loading in background)"); } else { codkLog("❌ #app div not found!"); } window.codkScrollY = window.scrollY || 0; document.body.style.overflow = 'hidden'; document.body.style.position = 'fixed'; document.body.style.width = '100%'; document.body.style.top = '-' + window.codkScrollY + 'px'; const mobile = isMobile(); if (mobile) { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = '100%'; iframe.contentWindow.document.body.style.height = '100vh'; } } catch (e) { } } else { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = 'auto'; iframe.contentWindow.document.documentElement.style.minHeight = '100%'; iframe.contentWindow.document.body.style.height = 'auto'; iframe.contentWindow.document.body.style.minHeight = '100%'; } } catch (e) { } } showIframe(iframe); codkLog("βœ… Spinner shown!"); }; const updateMessage = function(message) { codkLog("πŸ”΅ TDD Phase 3: Updating message to:", message); if (!iframe || !iframe.contentWindow) { codkLog("⚠️ Iframe or contentWindow not available (e.g. during redirect), skipping update"); return; } const iframeDoc = iframe.contentWindow.document; const messageEl = iframeDoc.querySelector('.message'); if (messageEl) { messageEl.innerHTML = message; codkLog("βœ… Message updated!"); } else { codkLog("❌ Message element not found!"); } }; const checkSvelteStatus = function() { codkLog("πŸ”΅ TDD Phase 3: Checking if Svelte is ready..."); if (window.codkingSvelteReady) { codkLog("βœ… Svelte is ready!"); updateMessage(""); } else { codkLog("⏳ Svelte is NOT ready yet, keeping Loading... message"); } }; const clearSpinner = function() { window.codkModalShowingSpinner = false; codkLog("πŸ”΅ Clearing spinner HTML..."); try { if (!iframe || !iframe.contentWindow) { codkLog("⚠️ Iframe or contentWindow not available (e.g. during redirect), skipping clearSpinner"); return; } const iframeDoc = iframe.contentWindow.document; const appDiv = iframeDoc.getElementById('app'); if (appDiv) { const spinnerContainer = appDiv.querySelector('.container'); const spinnerStyle = iframeDoc.querySelector('style'); const svelteMounted = iframe.contentWindow && iframe.contentWindow.appStore; if (spinnerContainer) { codkLog("⚠️ Spinner container still present", { svelteMounted: !!svelteMounted, appDivChildren: appDiv.children.length }); if (!svelteMounted) { codkLog("⚠️ Svelte not mounted yet, clearing spinner to allow mount..."); appDiv.innerHTML = ''; codkLog("βœ… Spinner cleared - Svelte can now mount"); } else { codkLog("βœ… Svelte is mounted, removing spinner container only..."); spinnerContainer.remove(); codkLog("βœ… Spinner container removed"); } } if (spinnerStyle && spinnerStyle.textContent.includes('.container')) { spinnerStyle.remove(); codkLog("βœ… Spinner style tag removed"); } const computedStyle = iframeDoc.defaultView.getComputedStyle(appDiv); if (computedStyle.position === 'fixed' && computedStyle.zIndex === '999999') { appDiv.style.cssText = ''; codkLog("βœ… #app spinner styles reset"); } if (!spinnerContainer && !spinnerStyle) { codkLog("βœ… Spinner already cleared by Svelte"); } } else { codkLog("⚠️ #app div not found"); } } catch (error) { codkLog("⚠️ Error clearing spinner:", error); } }; window.addEventListener('codking-svelte-ready', function() { codkLog("πŸŽ‰ TDD Phase 3: Received 'codking-svelte-ready' event!"); requestAnimationFrame(function() { clearSpinner(); setTimeout(function() { clearSpinner(); }, 50); }); }); const closeModal = function(isManualClose = true) { window.codkModalShowingSpinner = false; if (window.codkSvelteReadyPollId) { clearInterval(window.codkSvelteReadyPollId); window.codkSvelteReadyPollId = null; } codkLog("πŸ”΅ ========== CLOSING MODAL ==========", { isManualClose }); const iframeElement = document.getElementById('codk-full-modal-svelte'); if (!iframeElement) { codkLog("❌ CRITICAL: iframe element not found!"); return; } if (iframeElement !== iframe) { codkLog("⚠️ WARNING: iframe variable doesn't match DOM element!"); } const scrollY = window.codkScrollY || 0; codkLog("πŸ”΅ Saved scroll position:", scrollY); codkLog("πŸ”΅ Hiding iframe (CSS from Svelte)..."); hideIframe(iframe); document.body.style.removeProperty('overflow'); document.body.style.removeProperty('position'); document.body.style.removeProperty('width'); document.body.style.removeProperty('top'); document.body.style.removeProperty('height'); if (document.documentElement) { document.documentElement.style.removeProperty('overflow'); document.documentElement.style.removeProperty('position'); document.documentElement.style.removeProperty('width'); document.documentElement.style.removeProperty('height'); } codkLog("πŸ”΅ Body styles cleared"); if (scrollY > 0) { window.scrollTo(0, scrollY); codkLog("πŸ”΅ Scrolled to:", scrollY); } else { window.scrollTo(0, 0); codkLog("πŸ”΅ Scrolled to top"); } try { if (iframe && iframe.contentWindow && iframe.contentWindow.appStore) { setTimeout(function() { iframe.contentWindow.appStore.update(function(state) { return { ...state, isOpen: false }; }); codkLog("βœ… Svelte modal state updated to closed"); }, 0); } } catch (error) { codkLog("⚠️ Could not update Svelte store:", error); } if (typeof window.codkIsProcessing !== 'undefined') { window.codkIsProcessing = false; } window.codkScrollY = 0; codkLog("βœ… ========== MODAL CLOSE COMPLETE =========="); }; window.addEventListener('message', function(event) { codkLog("πŸ”΅ Received message from iframe:", event.data, event.origin); var closeModalMessage = event.data === 'codk-close-modal' || (Array.isArray(event.data) && event.data[0] === 'codk-close-modal'); if (closeModalMessage) { if (window.codkModalShowingSpinner === true) { codkLog("⏳ Ignoring 'codk-close-modal' while spinner is showing (Svelte not ready yet) - keeps modal open on Safari/redirect"); return; } codkLog("βœ… Received 'codk-close-modal' message - calling closeModal()"); closeModal(true); return; } if (event.data && typeof event.data === 'object' && event.data.type === 'codking:reattachButtonBlock') { if (buttonBlocking && typeof buttonBlocking.observeButtons === 'function') { buttonBlocking.observeButtons(); codkLog("βœ… Re-attached button block listeners (cart drawer mutation from Svelte)"); } return; } if (event.data && typeof event.data === 'object' && !Array.isArray(event.data) && event.data.type === 'codk-iframe-height') { const iframe = document.getElementById('codk-full-modal-svelte'); if (iframe && iframe.getAttribute('data-visible') === 'true' && !event.data.isMobile) { const height = event.data.height; const maxHeight = Math.min(height, window.innerHeight * 0.9); iframe.style.height = maxHeight + 'px'; codkLog("βœ… Updated iframe height from content:", { contentHeight: height, appliedHeight: maxHeight, viewportHeight: window.innerHeight }); } return; } if (Array.isArray(event.data) && event.data.length >= 1 && (event.data[0] === 'null' || event.data[0] == null)) { return; } codkLog("ℹ️ Ignoring message (not recognized):", event.data); }); if (!window.__codkScrollYDefined) { let _codkScrollY = 0; Object.defineProperty(window, 'codkScrollY', { get: function() { return _codkScrollY; }, set: function(value) { _codkScrollY = value; }, configurable: true }); window.__codkScrollYDefined = true; } function isShopifyBuyNowButton(buttonElement) { if (!buttonElement) { return false; } const productButtonSelectors = COD_BUTTON_SELECTORS.BUY_NOW; const isBuyNowButton = productButtonSelectors.some(function(selector) { return buttonElement.matches(selector); }); const isBuyNowClass = buttonElement.classList.contains("shopify-payment-button__button") && buttonElement.classList.contains( "shopify-payment-button__button--unbranded" ); const parentElement = buttonElement.closest("shopify-buy-it-now-button"); const hasBuyNowAttributes = parentElement && parentElement.hasAttribute("access-token") && parentElement.hasAttribute("buyer-country") && parentElement.hasAttribute("buyer-currency"); return isBuyNowButton || isBuyNowClass || hasBuyNowAttributes; } function resolveShopifyBuyNowButtonFromClick(clickedButton) { if (!clickedButton || typeof clickedButton.closest !== "function") { return null; } // Any click inside Shopify's custom element (including inner overlays) var host = clickedButton.closest("shopify-buy-it-now-button"); if (host) { var innerBtn = host.querySelector("button.shopify-payment-button__button") || host.querySelector("button[class*='shopify-payment-button__button']"); if (innerBtn && isShopifyBuyNowButton(innerBtn)) { return innerBtn; } } // Optional: some themes (e.g. TPO) add .tpo-buy-it-now-btn β€” most shops do not. // When absent, the user clicks the real button and checkShopifyBuyNowButtons() // returns true on the first isShopifyBuyNowButton(clickedButton) check. // TPO overlay sits as sibling of shopify-accelerated-checkout, so querySelector // from the overlay never finds the
    Advertisement
    Advertisement