$product = {"id":7921940594787,"title":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓","handle":"iphone-12-pro-mod-nx-toc01","description":null,"published_at":"2025-11-14T08:25:59+08:00","created_at":"2025-11-13T10:12:50+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-tocorocomugi","device-iPhone 12 Pro","merge","reseller-tocorocomugi"],"price":90000,"price_min":90000,"price_max":90000,"available":true,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":43834618511459,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019586147,"product_id":7921940594787,"position":7,"created_at":"2025-11-13T10:13:01+08:00","updated_at":"2025-11-13T10:13:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982","variant_ids":[43834618511459]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-TOC01","featured_media":{"alt":null,"id":26359439687779,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834621919331,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794020077667,"product_id":7921940594787,"position":10,"created_at":"2025-11-13T10:13:03+08:00","updated_at":"2025-11-13T10:13:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984","variant_ids":[43834621919331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-TOC01","featured_media":{"alt":null,"id":26359440080995,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834621952099,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019946595,"product_id":7921940594787,"position":9,"created_at":"2025-11-13T10:13:02+08:00","updated_at":"2025-11-13T10:13:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984","variant_ids":[43834621952099]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-TOC01","featured_media":{"alt":null,"id":26359439949923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834622050403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794018832483,"product_id":7921940594787,"position":4,"created_at":"2025-11-13T10:12:59+08:00","updated_at":"2025-11-13T10:13:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981","variant_ids":[43834622050403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-TOC01","featured_media":{"alt":null,"id":26359438835811,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834622083171,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019356771,"product_id":7921940594787,"position":6,"created_at":"2025-11-13T10:13:00+08:00","updated_at":"2025-11-13T10:13:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982","variant_ids":[43834622083171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-TOC01","featured_media":{"alt":null,"id":26359439458403,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/167f8da7ee1745ab04d0f68f18221a143538f387.webp?v=1762999979","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/41d1cdcf8d1ab515d0a9a0241eeedb0619c900b0.webp?v=1762999979","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d41246137fa3ab0b4c1c59521d64f009b8bdb73.webp?v=1762999980","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb39c4712e8b7c3d9dc73a64e52321bcd0ace036.webp?v=1762999981","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b146336fb84e0c8e452eb58c771196d588cc504.webp?v=1762999983","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4955c4d0c58b574017dc2b2266b9522fb504b906.webp?v=1762999985"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/167f8da7ee1745ab04d0f68f18221a143538f387.webp?v=1762999979","options":["color"],"media":[{"alt":null,"id":26359437754467,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/167f8da7ee1745ab04d0f68f18221a143538f387.webp?v=1762999979"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/167f8da7ee1745ab04d0f68f18221a143538f387.webp?v=1762999979","width":2000},{"alt":null,"id":26359438147683,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/41d1cdcf8d1ab515d0a9a0241eeedb0619c900b0.webp?v=1762999979"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/41d1cdcf8d1ab515d0a9a0241eeedb0619c900b0.webp?v=1762999979","width":2000},{"alt":null,"id":26359438475363,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d41246137fa3ab0b4c1c59521d64f009b8bdb73.webp?v=1762999980"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d41246137fa3ab0b4c1c59521d64f009b8bdb73.webp?v=1762999980","width":2000},{"alt":null,"id":26359438835811,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981","width":2000},{"alt":null,"id":26359439163491,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb39c4712e8b7c3d9dc73a64e52321bcd0ace036.webp?v=1762999981"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb39c4712e8b7c3d9dc73a64e52321bcd0ace036.webp?v=1762999981","width":2000},{"alt":null,"id":26359439458403,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982","width":2000},{"alt":null,"id":26359439687779,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982","width":2000},{"alt":null,"id":26359439818851,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b146336fb84e0c8e452eb58c771196d588cc504.webp?v=1762999983"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b146336fb84e0c8e452eb58c771196d588cc504.webp?v=1762999983","width":2000},{"alt":null,"id":26359439949923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984","width":2000},{"alt":null,"id":26359440080995,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984","width":2000},{"alt":null,"id":26359440277603,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4955c4d0c58b574017dc2b2266b9522fb504b906.webp?v=1762999985"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4955c4d0c58b574017dc2b2266b9522fb504b906.webp?v=1762999985","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43834618511459,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019586147,"product_id":7921940594787,"position":7,"created_at":"2025-11-13T10:13:01+08:00","updated_at":"2025-11-13T10:13:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982","variant_ids":[43834618511459]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-TOC01","featured_media":{"alt":null,"id":26359439687779,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834621919331,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794020077667,"product_id":7921940594787,"position":10,"created_at":"2025-11-13T10:13:03+08:00","updated_at":"2025-11-13T10:13:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984","variant_ids":[43834621919331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-TOC01","featured_media":{"alt":null,"id":26359440080995,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44efdee4a129eaea0497b82b61c3d8a13399ab87.webp?v=1762999984"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834621952099,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019946595,"product_id":7921940594787,"position":9,"created_at":"2025-11-13T10:13:02+08:00","updated_at":"2025-11-13T10:13:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984","variant_ids":[43834621952099]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-TOC01","featured_media":{"alt":null,"id":26359439949923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e3b749532fb6a4d60f861d628e85b390aa71212.webp?v=1762999984"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834622050403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794018832483,"product_id":7921940594787,"position":4,"created_at":"2025-11-13T10:12:59+08:00","updated_at":"2025-11-13T10:13:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981","variant_ids":[43834622050403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-TOC01","featured_media":{"alt":null,"id":26359438835811,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c9684ad8ae0f037984b43f35d3a1487f8cf6283.webp?v=1762999981"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834622083171,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019356771,"product_id":7921940594787,"position":6,"created_at":"2025-11-13T10:13:00+08:00","updated_at":"2025-11-13T10:13:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982","variant_ids":[43834622083171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-TOC01","featured_media":{"alt":null,"id":26359439458403,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bd47c620bab46a636164f71d504c83709d9068f.webp?v=1762999982"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43834618511459,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC01","requires_shipping":true,"taxable":true,"featured_image":{"id":34794019586147,"product_id":7921940594787,"position":7,"created_at":"2025-11-13T10:13:01+08:00","updated_at":"2025-11-13T10:13:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982","variant_ids":[43834618511459]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 布丁貓 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-TOC01","featured_media":{"alt":null,"id":26359439687779,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b16e65f0007d409139db962cd3b4ae93eae67fb0.webp?v=1762999982"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; $device_handle = null; $brand_handle = null; $type = ""; var sellingStatus // 只有設計款(SKU 含 '-')才需要合圖 if ($isMerge && $defaultVariant.sku.includes('-')) { $(document).ready(function() { var productImg = $product.images[0]; var bumperImg = window.getProductImageUrl($defaultVariant.sku.split('-')[0]); var layers = ($type === 'mod-nx-backplate' || $type === 'mod-backplate') ? [productImg, bumperImg] : [bumperImg, productImg]; window.mergeProductImages(layers).then(function (mergedImg) { $('.merged-img').attr('src', mergedImg); }); }); }; var sellingStatusData window.fetchSellingStatus().then(data => { try { sellingStatusData = data; } catch (error) { sellingStatusData = null console.error('Unable to parse selling status', error) } $(document).ready(function() { handleSellingStatus($defaultVariant.sku); }); }) function handleSellingStatus(currentSku) { if (!sellingStatusData) { console.error('No selling status available!') return } const sellingStatusElement = document.getElementById('selling-status') const addToCartButton = document.getElementById('AddToCart-product-template') const currentProductSku = currentSku.replace(/-(.*)$/, '-') if ($variants) { const flattenedSellingStatus = [...sellingStatusData.pending, ...sellingStatusData.preorder] const matchSellingStatusProduct = flattenedSellingStatus.filter(product => currentProductSku === product.sku) if (matchSellingStatusProduct.length > 0) { const isProductPending = matchSellingStatusProduct[0].status === 'pending' const matchDate = matchSellingStatusProduct[0].date sellingStatus = isProductPending ? "缺貨中" : "預購完成出貨日:" + matchDate sellingStatusElement.textContent = sellingStatus if (sellingStatus.includes("缺貨中")){ addToCartButton.disabled ='true'; addToCartButton.textContent = "缺貨中無法加入購物車" } else { addToCartButton.textContent = "加到購物車" } } else { sellingStatusElement.textContent = '' addToCartButton.textContent = "加到購物車" }; }; }; document.addEventListener('DOMContentLoaded', function () { var currentVariantSelect = document.getElementById('SingleOptionSelector-0') currentVariantSelect.addEventListener('change', function() { var currentSku = $('#current_sku').text() var skuElement = document.getElementById('current-sku') skuElement.textContent = currentSku handleSellingStatus(currentSku) }); });
// Override default values of shop.strings for each template. // Alternate product templates can change values of // add to cart button, sold out, and unavailable states here. theme.productStrings = { addToCart: "加到購物車", soldOut: "售完", unavailable: "停產" }