$product = {"id":8012332597347,"title":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布","handle":"iphone-12-mini-solidsuit-classic-magsafe-pe16","description":null,"published_at":"2026-05-14T15:03:09+08:00","created_at":"2026-05-14T11:18:29+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-pokemon","device-iPhone 12 Mini","merge","reseller-pokemon"],"price":135000,"price_min":135000,"price_max":135000,"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":44179217776739,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"MST011840A-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813824200803,"product_id":8012332597347,"position":5,"created_at":"2026-05-14T12:14:17+08:00","updated_at":"2026-05-14T12:14:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059","variant_ids":[44179217776739]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840A-PE16","featured_media":{"alt":null,"id":27338809180259,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179221577827,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011840E-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813824856163,"product_id":8012332597347,"position":6,"created_at":"2026-05-14T12:14:18+08:00","updated_at":"2026-05-14T12:14:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060","variant_ids":[44179221577827]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840E-PE16","featured_media":{"alt":null,"id":27338809835619,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179222626403,"title":"Bordeaux Red","option1":"Bordeaux Red","option2":null,"option3":null,"sku":"MST011840D-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822496867,"product_id":8012332597347,"position":2,"created_at":"2026-05-14T12:14:14+08:00","updated_at":"2026-05-14T12:14:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056","variant_ids":[44179222626403]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Bordeaux Red","public_title":"Bordeaux Red","options":["Bordeaux Red"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840D-PE16","featured_media":{"alt":null,"id":27338807476323,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179223478371,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"MST01184Z9-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822955619,"product_id":8012332597347,"position":3,"created_at":"2026-05-14T12:14:15+08:00","updated_at":"2026-05-14T12:14:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057","variant_ids":[44179223478371]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01184Z9-PE16","featured_media":{"alt":null,"id":27338807869539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179224395875,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01184Z8-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813823447139,"product_id":8012332597347,"position":4,"created_at":"2026-05-14T12:14:16+08:00","updated_at":"2026-05-14T12:14:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058","variant_ids":[44179224395875]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01184Z8-PE16","featured_media":{"alt":null,"id":27338808426595,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179225247843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118452-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822070883,"product_id":8012332597347,"position":1,"created_at":"2026-05-14T12:14:14+08:00","updated_at":"2026-05-14T12:14:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056","variant_ids":[44179225247843]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Black","public_title":"Black","options":["Black"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118452-PE16","featured_media":{"alt":null,"id":27338807050339,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056","options":["color"],"media":[{"alt":null,"id":27338807050339,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056","width":2000},{"alt":null,"id":27338807476323,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056","width":2000},{"alt":null,"id":27338807869539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057","width":2000},{"alt":null,"id":27338808426595,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058","width":2000},{"alt":null,"id":27338809180259,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059","width":2000},{"alt":null,"id":27338809835619,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $bumper = null; $variants = [{"id":44179217776739,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"MST011840A-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813824200803,"product_id":8012332597347,"position":5,"created_at":"2026-05-14T12:14:17+08:00","updated_at":"2026-05-14T12:14:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059","variant_ids":[44179217776739]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840A-PE16","featured_media":{"alt":null,"id":27338809180259,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179221577827,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011840E-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813824856163,"product_id":8012332597347,"position":6,"created_at":"2026-05-14T12:14:18+08:00","updated_at":"2026-05-14T12:14:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060","variant_ids":[44179221577827]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840E-PE16","featured_media":{"alt":null,"id":27338809835619,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da1ee991431719e43b14105911ac57e37952b62f.webp?v=1778732060"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179222626403,"title":"Bordeaux Red","option1":"Bordeaux Red","option2":null,"option3":null,"sku":"MST011840D-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822496867,"product_id":8012332597347,"position":2,"created_at":"2026-05-14T12:14:14+08:00","updated_at":"2026-05-14T12:14:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056","variant_ids":[44179222626403]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Bordeaux Red","public_title":"Bordeaux Red","options":["Bordeaux Red"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840D-PE16","featured_media":{"alt":null,"id":27338807476323,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59c96d908d47ec07807813dca745fb24f9efc04b.webp?v=1778732056"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179223478371,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"MST01184Z9-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822955619,"product_id":8012332597347,"position":3,"created_at":"2026-05-14T12:14:15+08:00","updated_at":"2026-05-14T12:14:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057","variant_ids":[44179223478371]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01184Z9-PE16","featured_media":{"alt":null,"id":27338807869539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e93bbe560be18b7b353a0532b2e501f68794097.webp?v=1778732057"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179224395875,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01184Z8-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813823447139,"product_id":8012332597347,"position":4,"created_at":"2026-05-14T12:14:16+08:00","updated_at":"2026-05-14T12:14:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058","variant_ids":[44179224395875]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01184Z8-PE16","featured_media":{"alt":null,"id":27338808426595,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ff096d19e5079d41678209e242afd06bafac169.webp?v=1778732058"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44179225247843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118452-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813822070883,"product_id":8012332597347,"position":1,"created_at":"2026-05-14T12:14:14+08:00","updated_at":"2026-05-14T12:14:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056","variant_ids":[44179225247843]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Black","public_title":"Black","options":["Black"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118452-PE16","featured_media":{"alt":null,"id":27338807050339,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c730640307bf991abce500753d3443a29347e9ff.webp?v=1778732056"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":44179217776739,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"MST011840A-PE16","requires_shipping":true,"taxable":true,"featured_image":{"id":35813824200803,"product_id":8012332597347,"position":5,"created_at":"2026-05-14T12:14:17+08:00","updated_at":"2026-05-14T12:14:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059","variant_ids":[44179217776739]},"available":true,"name":"iPhone 12 mini SolidSuit (MagSafe 兼容) 寶可夢 Pokémon Color-水伊布 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":135000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011840A-PE16","featured_media":{"alt":null,"id":27338809180259,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ec364020e7a88104192cd6485e951a53893dee6.webp?v=1778732059"}},"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: "停產" }