$product = {"id":7937572012131,"title":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟","handle":"iphone-12-pro-mod-nx-cjy14","description":null,"published_at":"2025-12-12T09:47:37+08:00","created_at":"2025-12-11T09:50:26+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-jychoioioi","device-iPhone 12 Pro","merge","reseller-jychoioioi"],"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":43883020845155,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908364899,"product_id":7937572012131,"position":6,"created_at":"2025-12-11T09:50:33+08:00","updated_at":"2025-12-11T09:50:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835","variant_ids":[43883020845155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493282812003,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023532131,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908594275,"product_id":7937572012131,"position":7,"created_at":"2025-12-11T09:50:33+08:00","updated_at":"2025-12-11T09:50:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835","variant_ids":[43883023532131]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493283008611,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023564899,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908102755,"product_id":7937572012131,"position":5,"created_at":"2025-12-11T09:50:32+08:00","updated_at":"2025-12-11T09:50:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834","variant_ids":[43883023564899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493282517091,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023695971,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930907414627,"product_id":7937572012131,"position":2,"created_at":"2025-12-11T09:50:30+08:00","updated_at":"2025-12-11T09:50:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832","variant_ids":[43883023695971]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493281828963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023728739,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930909544547,"product_id":7937572012131,"position":11,"created_at":"2025-12-11T09:50:35+08:00","updated_at":"2025-12-11T09:50:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837","variant_ids":[43883023728739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493284057187,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fb4d67dfcf651d5887991242cea53dce15b35ea.webp?v=1765417832","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6489b56cbcc191c0f94ea0dda281c67ec20b226a.webp?v=1765417833","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/77bccdda1a03bdbfc9f5b2cafb37b1928630175b.webp?v=1765417833","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28824d2237d6ecbfffbfdc67c7b351b56c1c7888.webp?v=1765417836","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5f5051979aae4610e715be9db91fabacf4d5f6f.webp?v=1765417836","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1d1fe18e3232ade01499f27ac98ecafe2f0f980.webp?v=1765417837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fb4d67dfcf651d5887991242cea53dce15b35ea.webp?v=1765417832","options":["color"],"media":[{"alt":null,"id":26493281632355,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fb4d67dfcf651d5887991242cea53dce15b35ea.webp?v=1765417832"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fb4d67dfcf651d5887991242cea53dce15b35ea.webp?v=1765417832","width":2000},{"alt":null,"id":26493281828963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832","width":2000},{"alt":null,"id":26493281992803,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6489b56cbcc191c0f94ea0dda281c67ec20b226a.webp?v=1765417833"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6489b56cbcc191c0f94ea0dda281c67ec20b226a.webp?v=1765417833","width":2000},{"alt":null,"id":26493282320483,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/77bccdda1a03bdbfc9f5b2cafb37b1928630175b.webp?v=1765417833"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/77bccdda1a03bdbfc9f5b2cafb37b1928630175b.webp?v=1765417833","width":2000},{"alt":null,"id":26493282517091,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834","width":2000},{"alt":null,"id":26493282812003,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835","width":2000},{"alt":null,"id":26493283008611,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835","width":2000},{"alt":null,"id":26493283237987,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28824d2237d6ecbfffbfdc67c7b351b56c1c7888.webp?v=1765417836"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28824d2237d6ecbfffbfdc67c7b351b56c1c7888.webp?v=1765417836","width":2000},{"alt":null,"id":26493283631203,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5f5051979aae4610e715be9db91fabacf4d5f6f.webp?v=1765417836"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5f5051979aae4610e715be9db91fabacf4d5f6f.webp?v=1765417836","width":2000},{"alt":null,"id":26493283860579,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1d1fe18e3232ade01499f27ac98ecafe2f0f980.webp?v=1765417837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1d1fe18e3232ade01499f27ac98ecafe2f0f980.webp?v=1765417837","width":2000},{"alt":null,"id":26493284057187,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43883020845155,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908364899,"product_id":7937572012131,"position":6,"created_at":"2025-12-11T09:50:33+08:00","updated_at":"2025-12-11T09:50:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835","variant_ids":[43883020845155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493282812003,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023532131,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908594275,"product_id":7937572012131,"position":7,"created_at":"2025-12-11T09:50:33+08:00","updated_at":"2025-12-11T09:50:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835","variant_ids":[43883023532131]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493283008611,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd449e3903e873094507948a98d6de7cdda5232a.webp?v=1765417835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023564899,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908102755,"product_id":7937572012131,"position":5,"created_at":"2025-12-11T09:50:32+08:00","updated_at":"2025-12-11T09:50:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834","variant_ids":[43883023564899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493282517091,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813e123f963707eff1b84fb4663d2f0e6385fe6d.webp?v=1765417834"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023695971,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930907414627,"product_id":7937572012131,"position":2,"created_at":"2025-12-11T09:50:30+08:00","updated_at":"2025-12-11T09:50:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832","variant_ids":[43883023695971]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493281828963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d618d220e145a55a94367ef9efe18019aaaae668.webp?v=1765417832"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883023728739,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930909544547,"product_id":7937572012131,"position":11,"created_at":"2025-12-11T09:50:35+08:00","updated_at":"2025-12-11T09:50:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837","variant_ids":[43883023728739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493284057187,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9ab1409f964ab4bcc9d6a57b89ff2615663319a1.webp?v=1765417837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43883020845155,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34930908364899,"product_id":7937572012131,"position":6,"created_at":"2025-12-11T09:50:33+08:00","updated_at":"2025-12-11T09:50:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835","variant_ids":[43883020845155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 番茄兄弟 - 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-CJY14","featured_media":{"alt":null,"id":26493282812003,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/012addba493986919f5e853a7f2f731b6874ea82.webp?v=1765417835"}},"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: "停產"
}