$product = {"id":7920115286115,"title":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的瑜珈時間","handle":"iphone-12-mini-mod-nx-hd66","description":null,"published_at":"2025-11-13T09:59:35+08:00","created_at":"2025-11-10T10:03:44+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-incrediville","device-iPhone 12 Mini","merge","reseller-incrediville"],"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":43827784188003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD66","requires_shipping":true,"taxable":true,"featured_image":{"id":34786057945187,"product_id":7920115286115,"position":13,"created_at":"2025-11-11T09:40:46+08:00","updated_at":"2025-11-11T09:40:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248","variant_ids":[43827784188003]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的瑜珈時間 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD66","featured_media":{"alt":null,"id":26351515041891,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa.webp?v=1762740230","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669.webp?v=1762740231","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba.webp?v=1762740232","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6.webp?v=1762740232","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c.webp?v=1762740233","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161.webp?v=1762740234","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4.webp?v=1762740234","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69.webp?v=1762740235","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf.webp?v=1762740236","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162.webp?v=1762740236","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9.webp?v=1762740237","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6_85209919-4a5a-4a65-a1e8-526966bbd6ae.webp?v=1762825248","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa_6f846e1b-96b6-449b-951f-3db02d5c76b9.webp?v=1762825249","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9_6b55c06b-6878-47bd-8c1d-014cf2036031.webp?v=1762825250","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162_fc0ae3a6-293c-4327-9ba5-13e313501c74.webp?v=1762825250","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba_3cac022e-bf99-4252-8b62-1432c1c2cd20.webp?v=1762825251","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c_0334a360-2b33-4653-ae61-c87ea2319456.webp?v=1762825251","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf_d0955a4a-0895-42b2-bd7c-140068d7a3e4.webp?v=1762825252","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69_59c2a0ac-f8d3-4f6d-9f55-7ffdaa805f3f.webp?v=1762825253","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161_6a306f44-a256-4288-b398-c16e152b03c0.webp?v=1762825254","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4_4da38ad9-2122-4441-9cb1-ce7778c3823b.webp?v=1762825254"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa.webp?v=1762740230","options":["color"],"media":[{"alt":null,"id":26346103439459,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa.webp?v=1762740230"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa.webp?v=1762740230","width":2000},{"alt":null,"id":26346104193123,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669.webp?v=1762740231"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669.webp?v=1762740231","width":2000},{"alt":null,"id":26346105569379,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba.webp?v=1762740232"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba.webp?v=1762740232","width":2000},{"alt":null,"id":26346106781795,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6.webp?v=1762740232"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6.webp?v=1762740232","width":2000},{"alt":null,"id":26346107797603,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c.webp?v=1762740233"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c.webp?v=1762740233","width":2000},{"alt":null,"id":26346109010019,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161.webp?v=1762740234"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161.webp?v=1762740234","width":2000},{"alt":null,"id":26346109927523,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4.webp?v=1762740234"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4.webp?v=1762740234","width":2000},{"alt":null,"id":26346110943331,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69.webp?v=1762740235"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69.webp?v=1762740235","width":2000},{"alt":null,"id":26346112024675,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf.webp?v=1762740236"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf.webp?v=1762740236","width":2000},{"alt":null,"id":26346113040483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162.webp?v=1762740236"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162.webp?v=1762740236","width":2000},{"alt":null,"id":26346114285667,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9.webp?v=1762740237"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9.webp?v=1762740237","width":2000},{"alt":null,"id":26351514779747,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6_85209919-4a5a-4a65-a1e8-526966bbd6ae.webp?v=1762825248"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac32fee2c936b60305ef33f5c0eb11e0f01fe5f6_85209919-4a5a-4a65-a1e8-526966bbd6ae.webp?v=1762825248","width":2000},{"alt":null,"id":26351515041891,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248","width":2000},{"alt":null,"id":26351515336803,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa_6f846e1b-96b6-449b-951f-3db02d5c76b9.webp?v=1762825249"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80608c456d6dd221bad636eb4c3b6ed35b71dcfa_6f846e1b-96b6-449b-951f-3db02d5c76b9.webp?v=1762825249","width":2000},{"alt":null,"id":26351515664483,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9_6b55c06b-6878-47bd-8c1d-014cf2036031.webp?v=1762825250"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f341e09105d3961b60eb3802f7bfb7fee63921d9_6b55c06b-6878-47bd-8c1d-014cf2036031.webp?v=1762825250","width":2000},{"alt":null,"id":26351515959395,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162_fc0ae3a6-293c-4327-9ba5-13e313501c74.webp?v=1762825250"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/989062e1d08a0ccd228f65b50ceaa58284dbb162_fc0ae3a6-293c-4327-9ba5-13e313501c74.webp?v=1762825250","width":2000},{"alt":null,"id":26351516254307,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba_3cac022e-bf99-4252-8b62-1432c1c2cd20.webp?v=1762825251"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcd4c196645d68591cb9c5d2271f790c0d561fba_3cac022e-bf99-4252-8b62-1432c1c2cd20.webp?v=1762825251","width":2000},{"alt":null,"id":26351516647523,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c_0334a360-2b33-4653-ae61-c87ea2319456.webp?v=1762825251"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f81b3af025b57ed1e8614287db4b6002b8bd592c_0334a360-2b33-4653-ae61-c87ea2319456.webp?v=1762825251","width":2000},{"alt":null,"id":26351516942435,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf_d0955a4a-0895-42b2-bd7c-140068d7a3e4.webp?v=1762825252"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/455e2780a2ac981cd840c13f2324f3db0fa23adf_d0955a4a-0895-42b2-bd7c-140068d7a3e4.webp?v=1762825252","width":2000},{"alt":null,"id":26351517171811,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69_59c2a0ac-f8d3-4f6d-9f55-7ffdaa805f3f.webp?v=1762825253"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9dd5b99d6f62fec0e58d85e190d9c96903dd4c69_59c2a0ac-f8d3-4f6d-9f55-7ffdaa805f3f.webp?v=1762825253","width":2000},{"alt":null,"id":26351517466723,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161_6a306f44-a256-4288-b398-c16e152b03c0.webp?v=1762825254"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/476ce87196b220b3c9e3bb78a36fba27bf093161_6a306f44-a256-4288-b398-c16e152b03c0.webp?v=1762825254","width":2000},{"alt":null,"id":26351517696099,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4_4da38ad9-2122-4441-9cb1-ce7778c3823b.webp?v=1762825254"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3a8ceee2338be97e2f8ce2a474138980c109a3b4_4da38ad9-2122-4441-9cb1-ce7778c3823b.webp?v=1762825254","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $bumper = null; $variants = [{"id":43827784188003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD66","requires_shipping":true,"taxable":true,"featured_image":{"id":34786057945187,"product_id":7920115286115,"position":13,"created_at":"2025-11-11T09:40:46+08:00","updated_at":"2025-11-11T09:40:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248","variant_ids":[43827784188003]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的瑜珈時間 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD66","featured_media":{"alt":null,"id":26351515041891,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43827784188003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD66","requires_shipping":true,"taxable":true,"featured_image":{"id":34786057945187,"product_id":7920115286115,"position":13,"created_at":"2025-11-11T09:40:46+08:00","updated_at":"2025-11-11T09:40:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248","variant_ids":[43827784188003]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的瑜珈時間 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD66","featured_media":{"alt":null,"id":26351515041891,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be6acc9330cf249dd1e74f5dbfa9f8a95367e669_cf950e66-d3d5-4ed4-83ab-b4d827db6412.webp?v=1762825248"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; $device_handle = null var sellingStatus if ($bumper) { $(document).ready(function() { var productImg = $product.images[0] var bumperVariants = $bumper.variants; var bumperColors = new Object(); var currentVariant = ''; var productType = ''; bumperVariants.forEach(variant => { bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src; }); if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') { mergeImages( [productImg, bumperColors[currentVariant]], { crossOrigin: 'anonymous' } ).then(mergedImg => { $('.merged-img').attr('src', mergedImg); }); } else { mergeImages( [bumperColors[currentVariant], productImg], { crossOrigin: 'anonymous' } ).then(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: "停產" }