$product = {"id":7956207632483,"title":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花","handle":"iphone-12-pro-mod-nx-eme02","description":null,"published_at":"2026-01-28T09:43:06+08:00","created_at":"2026-01-26T14:38:40+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-emerald","device-iPhone 12 Pro","merge","reseller-emerald"],"price":90000,"price_min":90000,"price_max":90000,"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":43966965252195,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188994147,"product_id":7956207632483,"position":5,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567","variant_ids":[43966965252195]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-EME02","featured_media":{"alt":null,"id":26703427469411,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978719843,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188568163,"product_id":7956207632483,"position":2,"created_at":"2026-01-26T14:39:24+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566","variant_ids":[43966978719843]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-EME02","featured_media":{"alt":null,"id":26703427108963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978981987,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189551203,"product_id":7956207632483,"position":8,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568","variant_ids":[43966978981987]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-EME02","featured_media":{"alt":null,"id":26703428059235,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966979473507,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147190042723,"product_id":7956207632483,"position":10,"created_at":"2026-01-26T14:39:27+08:00","updated_at":"2026-01-26T14:39:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569","variant_ids":[43966979473507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-EME02","featured_media":{"alt":null,"id":26703428550755,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966980128867,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188797539,"product_id":7956207632483,"position":4,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566","variant_ids":[43966980128867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-EME02","featured_media":{"alt":null,"id":26703427338339,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75fcb6372da7a219ff65139c0315062880a0826a.webp?v=1769409565","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6b54cbad548107139ddc95157c2775ec225d1ab.webp?v=1769409566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3a7415c346fa1a66bc98ff2f1964d9b397fb1a1.webp?v=1769409567","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68ad4a4cd7a6b7c6d8963b293e911568cf1d2290.webp?v=1769409568","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/56dc3a3c15888d6290d03cbc504cfebb23c26938.webp?v=1769409569","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2f556502e7fd580f93a7afeef1a44f6ecbfa578e.webp?v=1769409570"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75fcb6372da7a219ff65139c0315062880a0826a.webp?v=1769409565","options":["color"],"media":[{"alt":null,"id":26703426945123,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75fcb6372da7a219ff65139c0315062880a0826a.webp?v=1769409565"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75fcb6372da7a219ff65139c0315062880a0826a.webp?v=1769409565","width":2000},{"alt":null,"id":26703427108963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566","width":2000},{"alt":null,"id":26703427240035,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6b54cbad548107139ddc95157c2775ec225d1ab.webp?v=1769409566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6b54cbad548107139ddc95157c2775ec225d1ab.webp?v=1769409566","width":2000},{"alt":null,"id":26703427338339,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566","width":2000},{"alt":null,"id":26703427469411,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567","width":2000},{"alt":null,"id":26703427731555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3a7415c346fa1a66bc98ff2f1964d9b397fb1a1.webp?v=1769409567"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3a7415c346fa1a66bc98ff2f1964d9b397fb1a1.webp?v=1769409567","width":2000},{"alt":null,"id":26703427895395,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68ad4a4cd7a6b7c6d8963b293e911568cf1d2290.webp?v=1769409568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68ad4a4cd7a6b7c6d8963b293e911568cf1d2290.webp?v=1769409568","width":2000},{"alt":null,"id":26703428059235,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568","width":2000},{"alt":null,"id":26703428288611,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/56dc3a3c15888d6290d03cbc504cfebb23c26938.webp?v=1769409569"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/56dc3a3c15888d6290d03cbc504cfebb23c26938.webp?v=1769409569","width":2000},{"alt":null,"id":26703428550755,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569","width":2000},{"alt":null,"id":26703428747363,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2f556502e7fd580f93a7afeef1a44f6ecbfa578e.webp?v=1769409570"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2f556502e7fd580f93a7afeef1a44f6ecbfa578e.webp?v=1769409570","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43966965252195,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188994147,"product_id":7956207632483,"position":5,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567","variant_ids":[43966965252195]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-EME02","featured_media":{"alt":null,"id":26703427469411,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978719843,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188568163,"product_id":7956207632483,"position":2,"created_at":"2026-01-26T14:39:24+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566","variant_ids":[43966978719843]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-EME02","featured_media":{"alt":null,"id":26703427108963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c6400bad6afd0656d98fcccc6e67c27adbbf351.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978981987,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189551203,"product_id":7956207632483,"position":8,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568","variant_ids":[43966978981987]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-EME02","featured_media":{"alt":null,"id":26703428059235,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec15dc7b51a875784cb7edfb35457b69b0733a78.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966979473507,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147190042723,"product_id":7956207632483,"position":10,"created_at":"2026-01-26T14:39:27+08:00","updated_at":"2026-01-26T14:39:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569","variant_ids":[43966979473507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-EME02","featured_media":{"alt":null,"id":26703428550755,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5559bcd5c39338e92e2ad6a246a36a9af5c75842.webp?v=1769409569"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966980128867,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188797539,"product_id":7956207632483,"position":4,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566","variant_ids":[43966980128867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-EME02","featured_media":{"alt":null,"id":26703427338339,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/297fb489b260de7ae251d447833b65b0553b03fe.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43966965252195,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME02","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188994147,"product_id":7956207632483,"position":5,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567","variant_ids":[43966965252195]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 2月 杏花 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-EME02","featured_media":{"alt":null,"id":26703427469411,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0852f5c940fdb68d66ff19dca1c3550d7f3bd53.webp?v=1769409567"}},"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: "停產"
}