$product = {"id":7892621492323,"title":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl","handle":"iphone-12-pro-mod-nx-printable-aar02","description":null,"published_at":"2025-10-03T09:50:41+08:00","created_at":"2025-10-02T09:51:54+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-aaronchang","device-iPhone 12 Pro","merge","reseller-aaronchang"],"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":43756521062499,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543571828835,"product_id":7892621492323,"position":3,"created_at":"2025-10-02T09:52:05+08:00","updated_at":"2025-10-02T09:52:07+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927","variant_ids":[43756521062499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113326743651,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524535907,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543571533923,"product_id":7892621492323,"position":2,"created_at":"2025-10-02T09:52:04+08:00","updated_at":"2025-10-02T09:52:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926","variant_ids":[43756524535907]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113326415971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524568675,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543572615267,"product_id":7892621492323,"position":6,"created_at":"2025-10-02T09:52:10+08:00","updated_at":"2025-10-02T09:52:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932","variant_ids":[43756524568675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113327530083,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524634211,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543573762147,"product_id":7892621492323,"position":11,"created_at":"2025-10-02T09:52:17+08:00","updated_at":"2025-10-02T09:52:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939","variant_ids":[43756524634211]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113328644195,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524765283,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543573532771,"product_id":7892621492323,"position":10,"created_at":"2025-10-02T09:52:15+08:00","updated_at":"2025-10-02T09:52:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937","variant_ids":[43756524765283]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113328414819,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ccb0d67004b2c11b5aa7a3725bdcc783e5ea780b.webp?v=1759369925","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/934563ebbf1f5e18775af36369cb87dc5d2698c5.webp?v=1759369929","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9ddfd641924694c2fae82ba408f89340bb94d3b.webp?v=1759369930","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d918b8c34f58e1cb6e39f79f3f0f689da8a11fea.webp?v=1759369934","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07cb42520bfc2174bf2b95a4ee21ca9879b062f9.webp?v=1759369935","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70121f6b20af77c55ee9f712cbb253c73fed52cb.webp?v=1759369936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ccb0d67004b2c11b5aa7a3725bdcc783e5ea780b.webp?v=1759369925","options":["color"],"media":[{"alt":null,"id":26113326121059,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ccb0d67004b2c11b5aa7a3725bdcc783e5ea780b.webp?v=1759369925"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ccb0d67004b2c11b5aa7a3725bdcc783e5ea780b.webp?v=1759369925","width":2000},{"alt":null,"id":26113326415971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926","width":2000},{"alt":null,"id":26113326743651,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927","width":2000},{"alt":null,"id":26113326907491,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/934563ebbf1f5e18775af36369cb87dc5d2698c5.webp?v=1759369929"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/934563ebbf1f5e18775af36369cb87dc5d2698c5.webp?v=1759369929","width":2000},{"alt":null,"id":26113327267939,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9ddfd641924694c2fae82ba408f89340bb94d3b.webp?v=1759369930"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9ddfd641924694c2fae82ba408f89340bb94d3b.webp?v=1759369930","width":2000},{"alt":null,"id":26113327530083,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932","width":2000},{"alt":null,"id":26113327792227,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d918b8c34f58e1cb6e39f79f3f0f689da8a11fea.webp?v=1759369934"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d918b8c34f58e1cb6e39f79f3f0f689da8a11fea.webp?v=1759369934","width":2000},{"alt":null,"id":26113327923299,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07cb42520bfc2174bf2b95a4ee21ca9879b062f9.webp?v=1759369935"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07cb42520bfc2174bf2b95a4ee21ca9879b062f9.webp?v=1759369935","width":2000},{"alt":null,"id":26113328185443,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70121f6b20af77c55ee9f712cbb253c73fed52cb.webp?v=1759369936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70121f6b20af77c55ee9f712cbb253c73fed52cb.webp?v=1759369936","width":2000},{"alt":null,"id":26113328414819,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937","width":2000},{"alt":null,"id":26113328644195,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43756521062499,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543571828835,"product_id":7892621492323,"position":3,"created_at":"2025-10-02T09:52:05+08:00","updated_at":"2025-10-02T09:52:07+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927","variant_ids":[43756521062499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113326743651,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524535907,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543571533923,"product_id":7892621492323,"position":2,"created_at":"2025-10-02T09:52:04+08:00","updated_at":"2025-10-02T09:52:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926","variant_ids":[43756524535907]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113326415971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f492da85827ab58256ef7d95317c0dcad513f44.webp?v=1759369926"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524568675,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543572615267,"product_id":7892621492323,"position":6,"created_at":"2025-10-02T09:52:10+08:00","updated_at":"2025-10-02T09:52:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932","variant_ids":[43756524568675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113327530083,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31ed09f13aea6be23aa6bf2afa647971f7d50d36.webp?v=1759369932"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524634211,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543573762147,"product_id":7892621492323,"position":11,"created_at":"2025-10-02T09:52:17+08:00","updated_at":"2025-10-02T09:52:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939","variant_ids":[43756524634211]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113328644195,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c743a1aef67395f08c613d98e01658bc80d90ef.webp?v=1759369939"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756524765283,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543573532771,"product_id":7892621492323,"position":10,"created_at":"2025-10-02T09:52:15+08:00","updated_at":"2025-10-02T09:52:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937","variant_ids":[43756524765283]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113328414819,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/696bcb25a1ceb2044cfb152fdb3b984d77183689.webp?v=1759369937"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43756521062499,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR02","requires_shipping":true,"taxable":true,"featured_image":{"id":34543571828835,"product_id":7892621492323,"position":3,"created_at":"2025-10-02T09:52:05+08:00","updated_at":"2025-10-02T09:52:07+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927","variant_ids":[43756521062499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Girl - 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-AAR02","featured_media":{"alt":null,"id":26113326743651,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0c80bacb63fc5660a27689189b4a027dd122e223.webp?v=1759369927"}},"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: "停產"
}