$product = {"id":8048456237155,"title":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 迪士尼公主系列 追夢仙度瑞拉","handle":"iphone-12-pro-max-solidsuit-classic-magsafe-sf61","description":null,"published_at":"2026-06-29T15:26:56+08:00","created_at":"2026-06-29T10:07:54+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-disney-princess","device-iPhone 12 Pro Max","merge","reseller-disney-princess"],"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":44300298518627,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122927923299,"product_id":8048456237155,"position":2,"created_at":"2026-06-29T10:08:20+08:00","updated_at":"2026-06-29T10:08:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902","variant_ids":[44300298518627]},"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-SF61","featured_media":{"alt":null,"id":27628172705891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300303859811,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122929168483,"product_id":8048456237155,"position":5,"created_at":"2026-06-29T10:08:22+08:00","updated_at":"2026-06-29T10:08:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906","variant_ids":[44300303859811]},"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-SF61","featured_media":{"alt":null,"id":27628173951075,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304023651,"title":"Bordeaux Red","option1":"Bordeaux Red","option2":null,"option3":null,"sku":"MST011870D-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122927628387,"product_id":8048456237155,"position":1,"created_at":"2026-06-29T10:08:20+08:00","updated_at":"2026-06-29T10:08:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902","variant_ids":[44300304023651]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 迪士尼公主系列 追夢仙度瑞拉 - Bordeaux Red","public_title":"Bordeaux Red","options":["Bordeaux Red"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870D-SF61","featured_media":{"alt":null,"id":27628172410979,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304089187,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122928775267,"product_id":8048456237155,"position":4,"created_at":"2026-06-29T10:08:22+08:00","updated_at":"2026-06-29T10:08:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904","variant_ids":[44300304089187]},"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-SF61","featured_media":{"alt":null,"id":27628173557859,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304384099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122929496163,"product_id":8048456237155,"position":6,"created_at":"2026-06-29T10:08:23+08:00","updated_at":"2026-06-29T10:08:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905","variant_ids":[44300304384099]},"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-SF61","featured_media":{"alt":null,"id":27628174278755,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304908387,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122928250979,"product_id":8048456237155,"position":3,"created_at":"2026-06-29T10:08:21+08:00","updated_at":"2026-06-29T10:08:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903","variant_ids":[44300304908387]},"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-SF61","featured_media":{"alt":null,"id":27628173033571,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902","options":["color"],"media":[{"alt":null,"id":27628172410979,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902","width":2000},{"alt":null,"id":27628172705891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902","width":2000},{"alt":null,"id":27628173033571,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903","width":2000},{"alt":null,"id":27628173557859,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904","width":2000},{"alt":null,"id":27628173951075,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906","width":2000},{"alt":null,"id":27628174278755,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":44300298518627,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122927923299,"product_id":8048456237155,"position":2,"created_at":"2026-06-29T10:08:20+08:00","updated_at":"2026-06-29T10:08:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902","variant_ids":[44300298518627]},"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-SF61","featured_media":{"alt":null,"id":27628172705891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300303859811,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122929168483,"product_id":8048456237155,"position":5,"created_at":"2026-06-29T10:08:22+08:00","updated_at":"2026-06-29T10:08:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906","variant_ids":[44300303859811]},"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-SF61","featured_media":{"alt":null,"id":27628173951075,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d7ca83f31b3653c21215bc94b1c42b0d2468574.webp?v=1782698906"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304023651,"title":"Bordeaux Red","option1":"Bordeaux Red","option2":null,"option3":null,"sku":"MST011870D-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122927628387,"product_id":8048456237155,"position":1,"created_at":"2026-06-29T10:08:20+08:00","updated_at":"2026-06-29T10:08:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902","variant_ids":[44300304023651]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) 迪士尼公主系列 追夢仙度瑞拉 - Bordeaux Red","public_title":"Bordeaux Red","options":["Bordeaux Red"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870D-SF61","featured_media":{"alt":null,"id":27628172410979,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f025de9be99d0a63b44b047cce3bface12c99d44.webp?v=1782698902"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304089187,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122928775267,"product_id":8048456237155,"position":4,"created_at":"2026-06-29T10:08:22+08:00","updated_at":"2026-06-29T10:08:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904","variant_ids":[44300304089187]},"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-SF61","featured_media":{"alt":null,"id":27628173557859,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5cd3ec1f2b189c6a53f1148b027ad8036fff42b3.webp?v=1782698904"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304384099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122929496163,"product_id":8048456237155,"position":6,"created_at":"2026-06-29T10:08:23+08:00","updated_at":"2026-06-29T10:08:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905","variant_ids":[44300304384099]},"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-SF61","featured_media":{"alt":null,"id":27628174278755,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70132a2af8e84e730ee6f7cd9a25c26b34d07891.webp?v=1782698905"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":44300304908387,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122928250979,"product_id":8048456237155,"position":3,"created_at":"2026-06-29T10:08:21+08:00","updated_at":"2026-06-29T10:08:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903","variant_ids":[44300304908387]},"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-SF61","featured_media":{"alt":null,"id":27628173033571,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4cba90164dd0eb2f5c8eac417dae89bc2be913e.webp?v=1782698903"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":44300298518627,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-SF61","requires_shipping":true,"taxable":true,"featured_image":{"id":36122927923299,"product_id":8048456237155,"position":2,"created_at":"2026-06-29T10:08:20+08:00","updated_at":"2026-06-29T10:08:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902","variant_ids":[44300298518627]},"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-SF61","featured_media":{"alt":null,"id":27628172705891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c043fe78d167383cd94abe9b41db25ed0a7f7e1a.webp?v=1782698902"}},"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: "停產"
}