$product = {"id":7876049698915,"title":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生","handle":"iphone-12-pro-mod-nx-printable-ea109","description":null,"published_at":"2025-09-04T10:13:18+08:00","created_at":"2025-09-03T11:47:19+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-songsongmeow","device-iPhone 12 Pro","merge","reseller-songsongmeow"],"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":43675129282659,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416166076515,"product_id":7876049698915,"position":2,"created_at":"2025-09-03T11:47:23+08:00","updated_at":"2025-09-03T11:47:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245","variant_ids":[43675129282659]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988440916067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136262243,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416167026787,"product_id":7876049698915,"position":7,"created_at":"2025-09-03T11:47:27+08:00","updated_at":"2025-09-03T11:47:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249","variant_ids":[43675136262243]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988441866339,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136327779,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416166633571,"product_id":7876049698915,"position":5,"created_at":"2025-09-03T11:47:25+08:00","updated_at":"2025-09-03T11:47:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247","variant_ids":[43675136327779]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988441473123,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136426083,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416167649379,"product_id":7876049698915,"position":11,"created_at":"2025-09-03T11:47:30+08:00","updated_at":"2025-09-03T11:47:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252","variant_ids":[43675136426083]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988442488931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136524387,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416165879907,"product_id":7876049698915,"position":1,"created_at":"2025-09-03T11:47:23+08:00","updated_at":"2025-09-03T11:47:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245","variant_ids":[43675136524387]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988440719459,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5c2bd52cbb99c349de433c122fb6dac0d4fee417.webp?v=1756871246","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ce168c20295080628facef7218da38c16ab1d3e0.webp?v=1756871247","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfada2a34537b15a897d8c397759034d8768eab0.webp?v=1756871248","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3d55ac45a82a74225415f2bd5483fe5f1d41684.webp?v=1756871249","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf217cdd494e5dd2850115ccad2cfeaf4cf658e5.webp?v=1756871250","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55bcada1fc0163c465fd038c377d386fdf32fb8c.webp?v=1756871251","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245","options":["color"],"media":[{"alt":null,"id":25988440719459,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245","width":2000},{"alt":null,"id":25988440916067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245","width":2000},{"alt":null,"id":25988441079907,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5c2bd52cbb99c349de433c122fb6dac0d4fee417.webp?v=1756871246"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5c2bd52cbb99c349de433c122fb6dac0d4fee417.webp?v=1756871246","width":2000},{"alt":null,"id":25988441276515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ce168c20295080628facef7218da38c16ab1d3e0.webp?v=1756871247"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ce168c20295080628facef7218da38c16ab1d3e0.webp?v=1756871247","width":2000},{"alt":null,"id":25988441473123,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247","width":2000},{"alt":null,"id":25988441636963,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfada2a34537b15a897d8c397759034d8768eab0.webp?v=1756871248"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfada2a34537b15a897d8c397759034d8768eab0.webp?v=1756871248","width":2000},{"alt":null,"id":25988441866339,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249","width":2000},{"alt":null,"id":25988442095715,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3d55ac45a82a74225415f2bd5483fe5f1d41684.webp?v=1756871249"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3d55ac45a82a74225415f2bd5483fe5f1d41684.webp?v=1756871249","width":2000},{"alt":null,"id":25988442161251,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf217cdd494e5dd2850115ccad2cfeaf4cf658e5.webp?v=1756871250"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf217cdd494e5dd2850115ccad2cfeaf4cf658e5.webp?v=1756871250","width":2000},{"alt":null,"id":25988442325091,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55bcada1fc0163c465fd038c377d386fdf32fb8c.webp?v=1756871251"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55bcada1fc0163c465fd038c377d386fdf32fb8c.webp?v=1756871251","width":2000},{"alt":null,"id":25988442488931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43675129282659,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416166076515,"product_id":7876049698915,"position":2,"created_at":"2025-09-03T11:47:23+08:00","updated_at":"2025-09-03T11:47:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245","variant_ids":[43675129282659]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988440916067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136262243,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416167026787,"product_id":7876049698915,"position":7,"created_at":"2025-09-03T11:47:27+08:00","updated_at":"2025-09-03T11:47:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249","variant_ids":[43675136262243]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988441866339,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac0677d9716d9c3ca816f4befb0f7621cb28cc21.webp?v=1756871249"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136327779,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416166633571,"product_id":7876049698915,"position":5,"created_at":"2025-09-03T11:47:25+08:00","updated_at":"2025-09-03T11:47:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247","variant_ids":[43675136327779]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988441473123,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e300ec518aa00386af27c9e20d2a28b4832fbab6.webp?v=1756871247"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136426083,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416167649379,"product_id":7876049698915,"position":11,"created_at":"2025-09-03T11:47:30+08:00","updated_at":"2025-09-03T11:47:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252","variant_ids":[43675136426083]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988442488931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8365dc20cff129bb99b2ed33c6b1b03c98716189.webp?v=1756871252"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675136524387,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416165879907,"product_id":7876049698915,"position":1,"created_at":"2025-09-03T11:47:23+08:00","updated_at":"2025-09-03T11:47:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245","variant_ids":[43675136524387]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988440719459,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e9bb38c3c6acd7041309bfe69859c4e4e3bb0fb5.webp?v=1756871245"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43675129282659,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EA109","requires_shipping":true,"taxable":true,"featured_image":{"id":34416166076515,"product_id":7876049698915,"position":2,"created_at":"2025-09-03T11:47:23+08:00","updated_at":"2025-09-03T11:47:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245","variant_ids":[43675129282659]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 爽爽貓 by SECOND 好運發生 - 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-EA109","featured_media":{"alt":null,"id":25988440916067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/814cf6422067cbee8aa1276e0497a5292555ad72.webp?v=1756871245"}},"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: "停產"
}