$product = {"id":7892418986083,"title":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜","handle":"iphone-12-pro-max-solidsuit-classic-magsafe-to63","description":null,"published_at":"2025-10-03T10:04:56+08:00","created_at":"2025-10-01T15:53:12+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-le-petit-prince","device-iPhone 12 Pro Max","merge","reseller-le-petit-prince"],"price":125000,"price_min":125000,"price_max":125000,"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":43755624071267,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542196621411,"product_id":7892418986083,"position":1,"created_at":"2025-10-01T15:53:14+08:00","updated_at":"2025-10-01T15:53:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","variant_ids":[43755624071267]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870B-TO63","featured_media":{"alt":null,"id":26111961661539,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624104035,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542197702755,"product_id":7892418986083,"position":5,"created_at":"2025-10-01T15:53:17+08:00","updated_at":"2025-10-01T15:53:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198","variant_ids":[43755624104035]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01187O9-TO63","featured_media":{"alt":null,"id":26111962775651,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624202339,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542198587491,"product_id":7892418986083,"position":9,"created_at":"2025-10-01T15:53:23+08:00","updated_at":"2025-10-01T15:53:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205","variant_ids":[43755624202339]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Classic Blue","public_title":"Classic Blue","options":["Classic Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870C-TO63","featured_media":{"alt":null,"id":26111963660387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624235107,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542198128739,"product_id":7892418986083,"position":7,"created_at":"2025-10-01T15:53:21+08:00","updated_at":"2025-10-01T15:53:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203","variant_ids":[43755624235107]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870E-TO63","featured_media":{"alt":null,"id":26111963201635,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624267875,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542196949091,"product_id":7892418986083,"position":2,"created_at":"2025-10-01T15:53:15+08:00","updated_at":"2025-10-01T15:53:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196","variant_ids":[43755624267875]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118752-TO63","featured_media":{"alt":null,"id":26111962021987,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b31a1533ad2099e3d11105fd87d97506b8354ba.webp?v=1759305197","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/001e9caf5ef19f10f65be9cec609a240455fe5d3.webp?v=1759305198","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f90dd81c29fc0f38881eaf6bb61fc47c8ecec9.webp?v=1759305202","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a93737fc31af12f2cc972907701d8176c83df56.webp?v=1759305204","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","options":["color"],"media":[{"alt":null,"id":26111961661539,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","width":2000},{"alt":null,"id":26111962021987,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196","width":2000},{"alt":null,"id":26111962251363,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b31a1533ad2099e3d11105fd87d97506b8354ba.webp?v=1759305197"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b31a1533ad2099e3d11105fd87d97506b8354ba.webp?v=1759305197","width":2000},{"alt":null,"id":26111962513507,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/001e9caf5ef19f10f65be9cec609a240455fe5d3.webp?v=1759305198"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/001e9caf5ef19f10f65be9cec609a240455fe5d3.webp?v=1759305198","width":2000},{"alt":null,"id":26111962775651,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198","width":2000},{"alt":null,"id":26111962972259,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f90dd81c29fc0f38881eaf6bb61fc47c8ecec9.webp?v=1759305202"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f90dd81c29fc0f38881eaf6bb61fc47c8ecec9.webp?v=1759305202","width":2000},{"alt":null,"id":26111963201635,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203","width":2000},{"alt":null,"id":26111963431011,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a93737fc31af12f2cc972907701d8176c83df56.webp?v=1759305204"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a93737fc31af12f2cc972907701d8176c83df56.webp?v=1759305204","width":2000},{"alt":null,"id":26111963660387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43755624071267,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542196621411,"product_id":7892418986083,"position":1,"created_at":"2025-10-01T15:53:14+08:00","updated_at":"2025-10-01T15:53:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","variant_ids":[43755624071267]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870B-TO63","featured_media":{"alt":null,"id":26111961661539,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624104035,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542197702755,"product_id":7892418986083,"position":5,"created_at":"2025-10-01T15:53:17+08:00","updated_at":"2025-10-01T15:53:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198","variant_ids":[43755624104035]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01187O9-TO63","featured_media":{"alt":null,"id":26111962775651,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/148dfd213667162b2e9175594dfbdd94905f5108.webp?v=1759305198"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624202339,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542198587491,"product_id":7892418986083,"position":9,"created_at":"2025-10-01T15:53:23+08:00","updated_at":"2025-10-01T15:53:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205","variant_ids":[43755624202339]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Classic Blue","public_title":"Classic Blue","options":["Classic Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870C-TO63","featured_media":{"alt":null,"id":26111963660387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66c8e42046448756bd24c3f11dc6f4d33782e0d.webp?v=1759305205"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624235107,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542198128739,"product_id":7892418986083,"position":7,"created_at":"2025-10-01T15:53:21+08:00","updated_at":"2025-10-01T15:53:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203","variant_ids":[43755624235107]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870E-TO63","featured_media":{"alt":null,"id":26111963201635,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2dc38efaedd101b92fb691affda63e72f95c9291.webp?v=1759305203"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755624267875,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542196949091,"product_id":7892418986083,"position":2,"created_at":"2025-10-01T15:53:15+08:00","updated_at":"2025-10-01T15:53:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196","variant_ids":[43755624267875]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118752-TO63","featured_media":{"alt":null,"id":26111962021987,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/24fb488e1ead4b72b1d46aa2a1876759bb829951.webp?v=1759305196"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43755624071267,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TO63","requires_shipping":true,"taxable":true,"featured_image":{"id":34542196621411,"product_id":7892418986083,"position":1,"created_at":"2025-10-01T15:53:14+08:00","updated_at":"2025-10-01T15:53:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195","variant_ids":[43755624071267]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 小王子 小王子與狐狸 - 流星雨之夜 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870B-TO63","featured_media":{"alt":null,"id":26111961661539,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/248398e52870694bc1ff6056dc4a9fbf8aa6b4b2.webp?v=1759305195"}},"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: "停產" }