$product = {"id":7911177912419,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU","handle":"iphone-12-pro-mod-nx-magsafe-printable-pos11","description":null,"published_at":"2025-11-05T10:51:25+08:00","created_at":"2025-11-04T10:29:27+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-posterlad","device-iPhone 12 Pro","merge","reseller-posterlad"],"price":110000,"price_min":110000,"price_max":110000,"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":43811878731875,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729006760035,"product_id":7911177912419,"position":3,"created_at":"2025-11-04T10:29:34+08:00","updated_at":"2025-11-04T10:29:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376","variant_ids":[43811878731875]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS11","featured_media":{"alt":null,"id":26296875221091,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881746531,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007087715,"product_id":7911177912419,"position":5,"created_at":"2025-11-04T10:29:36+08:00","updated_at":"2025-11-04T10:29:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378","variant_ids":[43811881746531]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-POS11","featured_media":{"alt":null,"id":26296875581539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881779299,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007972451,"product_id":7911177912419,"position":9,"created_at":"2025-11-04T10:29:39+08:00","updated_at":"2025-11-04T10:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381","variant_ids":[43811881779299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-POS11","featured_media":{"alt":null,"id":26296876433507,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881812067,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007349859,"product_id":7911177912419,"position":6,"created_at":"2025-11-04T10:29:37+08:00","updated_at":"2025-11-04T10:29:39+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379","variant_ids":[43811881812067]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-POS11","featured_media":{"alt":null,"id":26296875810915,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811882008675,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729006366819,"product_id":7911177912419,"position":1,"created_at":"2025-11-04T10:29:32+08:00","updated_at":"2025-11-04T10:29:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374","variant_ids":[43811882008675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-POS11","featured_media":{"alt":null,"id":26296874860643,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bc773dae2c3c1e01946305749aed79e478941e9f.webp?v=1762223375","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cc5fae07cd89a6147e01aec4f284ba823ea7b8ec.webp?v=1762223377","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aff13a8070d36e629a0cf2263520b9b9e4250d66.webp?v=1762223379","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/337608ca161c6f63d05c48cd42c99a8ad3be5e62.webp?v=1762223380","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00f885251287e09b8bb4e5e4a265c8574a7df88c.webp?v=1762223381","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ad9d97b9030a8e9f5ea860fb2e2bc7b7ea0a9099.webp?v=1762223382"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374","options":["color"],"media":[{"alt":null,"id":26296874860643,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374","width":2000},{"alt":null,"id":26296875024483,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bc773dae2c3c1e01946305749aed79e478941e9f.webp?v=1762223375"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bc773dae2c3c1e01946305749aed79e478941e9f.webp?v=1762223375","width":2000},{"alt":null,"id":26296875221091,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376","width":2000},{"alt":null,"id":26296875352163,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cc5fae07cd89a6147e01aec4f284ba823ea7b8ec.webp?v=1762223377"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cc5fae07cd89a6147e01aec4f284ba823ea7b8ec.webp?v=1762223377","width":2000},{"alt":null,"id":26296875581539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378","width":2000},{"alt":null,"id":26296875810915,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379","width":2000},{"alt":null,"id":26296876040291,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aff13a8070d36e629a0cf2263520b9b9e4250d66.webp?v=1762223379"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aff13a8070d36e629a0cf2263520b9b9e4250d66.webp?v=1762223379","width":2000},{"alt":null,"id":26296876335203,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/337608ca161c6f63d05c48cd42c99a8ad3be5e62.webp?v=1762223380"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/337608ca161c6f63d05c48cd42c99a8ad3be5e62.webp?v=1762223380","width":2000},{"alt":null,"id":26296876433507,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381","width":2000},{"alt":null,"id":26296876695651,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00f885251287e09b8bb4e5e4a265c8574a7df88c.webp?v=1762223381"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00f885251287e09b8bb4e5e4a265c8574a7df88c.webp?v=1762223381","width":2000},{"alt":null,"id":26296876925027,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ad9d97b9030a8e9f5ea860fb2e2bc7b7ea0a9099.webp?v=1762223382"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ad9d97b9030a8e9f5ea860fb2e2bc7b7ea0a9099.webp?v=1762223382","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43811878731875,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729006760035,"product_id":7911177912419,"position":3,"created_at":"2025-11-04T10:29:34+08:00","updated_at":"2025-11-04T10:29:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376","variant_ids":[43811878731875]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS11","featured_media":{"alt":null,"id":26296875221091,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881746531,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007087715,"product_id":7911177912419,"position":5,"created_at":"2025-11-04T10:29:36+08:00","updated_at":"2025-11-04T10:29:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378","variant_ids":[43811881746531]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-POS11","featured_media":{"alt":null,"id":26296875581539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/590cb70c6363cd88baaaaf9c5d9e9bb6ce54702c.webp?v=1762223378"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881779299,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007972451,"product_id":7911177912419,"position":9,"created_at":"2025-11-04T10:29:39+08:00","updated_at":"2025-11-04T10:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381","variant_ids":[43811881779299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-POS11","featured_media":{"alt":null,"id":26296876433507,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e38655b66b4c830f30e4e2ecbfe0489fc53453e.webp?v=1762223381"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811881812067,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729007349859,"product_id":7911177912419,"position":6,"created_at":"2025-11-04T10:29:37+08:00","updated_at":"2025-11-04T10:29:39+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379","variant_ids":[43811881812067]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-POS11","featured_media":{"alt":null,"id":26296875810915,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fd1840b82537de9900ed132a2b02f2103312381.webp?v=1762223379"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43811882008675,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729006366819,"product_id":7911177912419,"position":1,"created_at":"2025-11-04T10:29:32+08:00","updated_at":"2025-11-04T10:29:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374","variant_ids":[43811882008675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-POS11","featured_media":{"alt":null,"id":26296874860643,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9d5c07157ac560b0f1909de905e10cd025dbde2.webp?v=1762223374"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43811878731875,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS11","requires_shipping":true,"taxable":true,"featured_image":{"id":34729006760035,"product_id":7911177912419,"position":3,"created_at":"2025-11-04T10:29:34+08:00","updated_at":"2025-11-04T10:29:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376","variant_ids":[43811878731875]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad BE YOU - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS11","featured_media":{"alt":null,"id":26296875221091,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c95a453769477f18514cd513564882a99f6078.webp?v=1762223376"}},"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: "停產"
}