$product = {"id":7873273561187,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest","handle":"iphone-12-pro-mod-nx-magsafe-printable-kei10","description":null,"published_at":"2025-09-01T10:52:46+08:00","created_at":"2025-09-01T09:40:53+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-keigo","device-iPhone 12 Pro","merge","reseller-keigo"],"price":110000,"price_min":110000,"price_max":110000,"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":43658561912931,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409916694627,"product_id":7873273561187,"position":9,"created_at":"2025-09-01T09:41:03+08:00","updated_at":"2025-09-01T09:41:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865","variant_ids":[43658561912931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-KEI10","featured_media":{"alt":null,"id":25982231674979,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658561945699,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409917120611,"product_id":7873273561187,"position":11,"created_at":"2025-09-01T09:41:04+08:00","updated_at":"2025-09-01T09:41:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866","variant_ids":[43658561945699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-KEI10","featured_media":{"alt":null,"id":25982232100963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562044003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409915220067,"product_id":7873273561187,"position":3,"created_at":"2025-09-01T09:40:59+08:00","updated_at":"2025-09-01T09:41:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861","variant_ids":[43658562044003]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-KEI10","featured_media":{"alt":null,"id":25982230200419,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562076771,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409916498019,"product_id":7873273561187,"position":8,"created_at":"2025-09-01T09:41:02+08:00","updated_at":"2025-09-01T09:41:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865","variant_ids":[43658562076771]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-KEI10","featured_media":{"alt":null,"id":25982231478371,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562175075,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409915056227,"product_id":7873273561187,"position":2,"created_at":"2025-09-01T09:40:58+08:00","updated_at":"2025-09-01T09:41:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860","variant_ids":[43658562175075]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-KEI10","featured_media":{"alt":null,"id":25982230036579,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351bd917ece9f326c24141e884f945617022f263.webp?v=1756690859","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a0440a8021951aaa548d253b0dc199e9c4d81c5.webp?v=1756690862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1abda195a00ca7ea682973ff9365210183764dce.webp?v=1756690863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d7369ea84f6e7d9efa005c6334eeb41444b2062.webp?v=1756690863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b45b8be95c29e9d13455e9cccd368758d7abd0aa.webp?v=1756690864","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8684f94dd878793a6c1f67eece07f578b73a85.webp?v=1756690866","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351bd917ece9f326c24141e884f945617022f263.webp?v=1756690859","options":["color"],"media":[{"alt":null,"id":25982229872739,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351bd917ece9f326c24141e884f945617022f263.webp?v=1756690859"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351bd917ece9f326c24141e884f945617022f263.webp?v=1756690859","width":2000},{"alt":null,"id":25982230036579,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860","width":2000},{"alt":null,"id":25982230200419,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861","width":2000},{"alt":null,"id":25982230364259,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a0440a8021951aaa548d253b0dc199e9c4d81c5.webp?v=1756690862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a0440a8021951aaa548d253b0dc199e9c4d81c5.webp?v=1756690862","width":2000},{"alt":null,"id":25982230659171,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1abda195a00ca7ea682973ff9365210183764dce.webp?v=1756690863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1abda195a00ca7ea682973ff9365210183764dce.webp?v=1756690863","width":2000},{"alt":null,"id":25982231019619,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d7369ea84f6e7d9efa005c6334eeb41444b2062.webp?v=1756690863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d7369ea84f6e7d9efa005c6334eeb41444b2062.webp?v=1756690863","width":2000},{"alt":null,"id":25982231248995,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b45b8be95c29e9d13455e9cccd368758d7abd0aa.webp?v=1756690864"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b45b8be95c29e9d13455e9cccd368758d7abd0aa.webp?v=1756690864","width":2000},{"alt":null,"id":25982231478371,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865","width":2000},{"alt":null,"id":25982231674979,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865","width":2000},{"alt":null,"id":25982231904355,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8684f94dd878793a6c1f67eece07f578b73a85.webp?v=1756690866"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8684f94dd878793a6c1f67eece07f578b73a85.webp?v=1756690866","width":2000},{"alt":null,"id":25982232100963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43658561912931,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409916694627,"product_id":7873273561187,"position":9,"created_at":"2025-09-01T09:41:03+08:00","updated_at":"2025-09-01T09:41:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865","variant_ids":[43658561912931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-KEI10","featured_media":{"alt":null,"id":25982231674979,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658561945699,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409917120611,"product_id":7873273561187,"position":11,"created_at":"2025-09-01T09:41:04+08:00","updated_at":"2025-09-01T09:41:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866","variant_ids":[43658561945699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-KEI10","featured_media":{"alt":null,"id":25982232100963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5080a2e86a57b44220ad91e401ac553562060f06.webp?v=1756690866"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562044003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409915220067,"product_id":7873273561187,"position":3,"created_at":"2025-09-01T09:40:59+08:00","updated_at":"2025-09-01T09:41:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861","variant_ids":[43658562044003]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-KEI10","featured_media":{"alt":null,"id":25982230200419,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bd1fe8e15ccf152f70de645ed2b766ac6aef9246.webp?v=1756690861"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562076771,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409916498019,"product_id":7873273561187,"position":8,"created_at":"2025-09-01T09:41:02+08:00","updated_at":"2025-09-01T09:41:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865","variant_ids":[43658562076771]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-KEI10","featured_media":{"alt":null,"id":25982231478371,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6247c4ccf4f0df0ed1bebba5de33a8e178dc851.webp?v=1756690865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658562175075,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409915056227,"product_id":7873273561187,"position":2,"created_at":"2025-09-01T09:40:58+08:00","updated_at":"2025-09-01T09:41:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860","variant_ids":[43658562175075]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-KEI10","featured_media":{"alt":null,"id":25982230036579,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf6962355cf5ab5370f76156ac11a50e607b771.webp?v=1756690860"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43658561912931,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409916694627,"product_id":7873273561187,"position":9,"created_at":"2025-09-01T09:41:03+08:00","updated_at":"2025-09-01T09:41:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865","variant_ids":[43658561912931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Keigo Rest - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-KEI10","featured_media":{"alt":null,"id":25982231674979,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f822e7dd615bddd3e8d0fbb0f362e9a7f1eb3505.webp?v=1756690865"}},"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: "停產" }