$product = {"id":7827288850531,"title":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels","handle":"iphone-12-pro-max-solidsuit-magsafe-bumper-back-crossover-design-tdf13","description":null,"published_at":"2025-07-14T10:55:34+08:00","created_at":"2025-06-26T15:27:36+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-tour-de-france","device-iPhone 12 Pro Max","merge","reseller-tour-de-france"],"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":43497460465763,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082259042403,"product_id":7827288850531,"position":6,"created_at":"2025-06-26T15:27:43+08:00","updated_at":"2025-06-26T15:27:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865","variant_ids":[43497460465763]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742947516515,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460498531,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082258583651,"product_id":7827288850531,"position":5,"created_at":"2025-06-26T15:27:42+08:00","updated_at":"2025-06-26T15:27:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864","variant_ids":[43497460498531]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742947352675,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460629603,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082256552035,"product_id":7827288850531,"position":1,"created_at":"2025-06-26T15:27:40+08:00","updated_at":"2025-06-26T15:27:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862","variant_ids":[43497460629603]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742946435171,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460695139,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082261237859,"product_id":7827288850531,"position":9,"created_at":"2025-06-26T15:27:45+08:00","updated_at":"2025-06-26T15:27:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867","variant_ids":[43497460695139]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742948663395,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460727907,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082258321507,"product_id":7827288850531,"position":4,"created_at":"2025-06-26T15:27:42+08:00","updated_at":"2025-06-26T15:27:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864","variant_ids":[43497460727907]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742946926691,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6275885de91e3b37b2b263c0d5b9eaedabad7b5.webp?v=1750922863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97638ec315e7cf0d90455cf0f532ccfa655bcca5.webp?v=1750922863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da4b93dc9f8cc154f071029c740f226c1adce5db.webp?v=1750922865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e8c572cd18f69844dfff94c9588c695178ccbc8f.webp?v=1750922866","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f064cf7f251bf588cf2d5c98b79e8618d7937206.webp?v=1750922867"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862","options":["color"],"media":[{"alt":null,"id":25742946435171,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862","width":2000},{"alt":null,"id":25742946566243,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6275885de91e3b37b2b263c0d5b9eaedabad7b5.webp?v=1750922863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6275885de91e3b37b2b263c0d5b9eaedabad7b5.webp?v=1750922863","width":2000},{"alt":null,"id":25742946762851,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97638ec315e7cf0d90455cf0f532ccfa655bcca5.webp?v=1750922863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97638ec315e7cf0d90455cf0f532ccfa655bcca5.webp?v=1750922863","width":2000},{"alt":null,"id":25742946926691,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864","width":2000},{"alt":null,"id":25742947352675,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864","width":2000},{"alt":null,"id":25742947516515,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865","width":2000},{"alt":null,"id":25742948073571,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da4b93dc9f8cc154f071029c740f226c1adce5db.webp?v=1750922865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da4b93dc9f8cc154f071029c740f226c1adce5db.webp?v=1750922865","width":2000},{"alt":null,"id":25742948368483,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e8c572cd18f69844dfff94c9588c695178ccbc8f.webp?v=1750922866"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e8c572cd18f69844dfff94c9588c695178ccbc8f.webp?v=1750922866","width":2000},{"alt":null,"id":25742948663395,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867","width":2000},{"alt":null,"id":25742948991075,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f064cf7f251bf588cf2d5c98b79e8618d7937206.webp?v=1750922867"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f064cf7f251bf588cf2d5c98b79e8618d7937206.webp?v=1750922867","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43497460465763,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082259042403,"product_id":7827288850531,"position":6,"created_at":"2025-06-26T15:27:43+08:00","updated_at":"2025-06-26T15:27:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865","variant_ids":[43497460465763]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742947516515,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460498531,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082258583651,"product_id":7827288850531,"position":5,"created_at":"2025-06-26T15:27:42+08:00","updated_at":"2025-06-26T15:27:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864","variant_ids":[43497460498531]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742947352675,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e47fb50df5da7f3f6176f276f8f8fa7ab6214519.webp?v=1750922864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460629603,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082256552035,"product_id":7827288850531,"position":1,"created_at":"2025-06-26T15:27:40+08:00","updated_at":"2025-06-26T15:27:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862","variant_ids":[43497460629603]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742946435171,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48e7eba1557a898ca38ef95794aa1ee7d199bc82.webp?v=1750922862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460695139,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082261237859,"product_id":7827288850531,"position":9,"created_at":"2025-06-26T15:27:45+08:00","updated_at":"2025-06-26T15:27:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867","variant_ids":[43497460695139]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742948663395,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21659b9195fcd5db74fb37d23a1900aab7fac42d.webp?v=1750922867"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497460727907,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082258321507,"product_id":7827288850531,"position":4,"created_at":"2025-06-26T15:27:42+08:00","updated_at":"2025-06-26T15:27:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864","variant_ids":[43497460727907]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742946926691,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bb4a416b10dd0dd7420b431eedf570cdefaf279.webp?v=1750922864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43497460465763,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF13","requires_shipping":true,"taxable":true,"featured_image":{"id":34082259042403,"product_id":7827288850531,"position":6,"created_at":"2025-06-26T15:27:43+08:00","updated_at":"2025-06-26T15:27:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865","variant_ids":[43497460465763]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Elite Levels - 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-TDF13","featured_media":{"alt":null,"id":25742947516515,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ee85a79956a61ae6472792b78af3f2b2bc62cef.webp?v=1750922865"}},"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: "停產"
}