$product = {"id":7892665172067,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang","handle":"iphone-12-pro-mod-nx-magsafe-printable-aar04","description":null,"published_at":"2025-10-03T09:43:33+08:00","created_at":"2025-10-02T10:05:28+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":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":43756689391715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543743271011,"product_id":7892665172067,"position":1,"created_at":"2025-10-02T10:05:30+08:00","updated_at":"2025-10-02T10:05:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","variant_ids":[43756689391715]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113498153059,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692734051,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543744352355,"product_id":7892665172067,"position":4,"created_at":"2025-10-02T10:05:34+08:00","updated_at":"2025-10-02T10:05:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736","variant_ids":[43756692734051]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113499299939,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692766819,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543744778339,"product_id":7892665172067,"position":5,"created_at":"2025-10-02T10:05:34+08:00","updated_at":"2025-10-02T10:05:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737","variant_ids":[43756692766819]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113499660387,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692832355,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543743565923,"product_id":7892665172067,"position":2,"created_at":"2025-10-02T10:05:30+08:00","updated_at":"2025-10-02T10:05:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733","variant_ids":[43756692832355]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113498447971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692963427,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543745237091,"product_id":7892665172067,"position":7,"created_at":"2025-10-02T10:05:36+08:00","updated_at":"2025-10-02T10:05:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738","variant_ids":[43756692963427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113500119139,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a40634f6c56cb7b99b2a7d0a0620d04453e57feb.webp?v=1759370734","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/532fd912ba2f4386bae8c7f5efe63847880bae81.webp?v=1759370737","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a2504bdd309655f880d1737278d17ab96390c8c.webp?v=1759370738","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4924a44a9ae7c224d5e4d9ecfa7583fac9d49c58.webp?v=1759370739","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51f66a3371678323174599572a525463e7c02d5.webp?v=1759370740","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60f7e32b2596429e205a20ac37a1d899acc3abc2.webp?v=1759370741"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","options":["color"],"media":[{"alt":null,"id":26113498153059,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","width":2000},{"alt":null,"id":26113498447971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733","width":2000},{"alt":null,"id":26113498841187,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a40634f6c56cb7b99b2a7d0a0620d04453e57feb.webp?v=1759370734"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a40634f6c56cb7b99b2a7d0a0620d04453e57feb.webp?v=1759370734","width":2000},{"alt":null,"id":26113499299939,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736","width":2000},{"alt":null,"id":26113499660387,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737","width":2000},{"alt":null,"id":26113499955299,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/532fd912ba2f4386bae8c7f5efe63847880bae81.webp?v=1759370737"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/532fd912ba2f4386bae8c7f5efe63847880bae81.webp?v=1759370737","width":2000},{"alt":null,"id":26113500119139,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738","width":2000},{"alt":null,"id":26113500217443,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a2504bdd309655f880d1737278d17ab96390c8c.webp?v=1759370738"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a2504bdd309655f880d1737278d17ab96390c8c.webp?v=1759370738","width":2000},{"alt":null,"id":26113500381283,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4924a44a9ae7c224d5e4d9ecfa7583fac9d49c58.webp?v=1759370739"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4924a44a9ae7c224d5e4d9ecfa7583fac9d49c58.webp?v=1759370739","width":2000},{"alt":null,"id":26113500577891,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51f66a3371678323174599572a525463e7c02d5.webp?v=1759370740"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51f66a3371678323174599572a525463e7c02d5.webp?v=1759370740","width":2000},{"alt":null,"id":26113500676195,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60f7e32b2596429e205a20ac37a1d899acc3abc2.webp?v=1759370741"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60f7e32b2596429e205a20ac37a1d899acc3abc2.webp?v=1759370741","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43756689391715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543743271011,"product_id":7892665172067,"position":1,"created_at":"2025-10-02T10:05:30+08:00","updated_at":"2025-10-02T10:05:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","variant_ids":[43756689391715]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113498153059,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692734051,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543744352355,"product_id":7892665172067,"position":4,"created_at":"2025-10-02T10:05:34+08:00","updated_at":"2025-10-02T10:05:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736","variant_ids":[43756692734051]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113499299939,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3593763ac5c34b0aa01fd9f5ce6af43908c13fe7.webp?v=1759370736"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692766819,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543744778339,"product_id":7892665172067,"position":5,"created_at":"2025-10-02T10:05:34+08:00","updated_at":"2025-10-02T10:05:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737","variant_ids":[43756692766819]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113499660387,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a065313e09f87a07e2463f1886da1cf4bb8bb94.webp?v=1759370737"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692832355,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543743565923,"product_id":7892665172067,"position":2,"created_at":"2025-10-02T10:05:30+08:00","updated_at":"2025-10-02T10:05:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733","variant_ids":[43756692832355]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113498447971,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb63a0db29f8c1114d954735712439d11f665ad3.webp?v=1759370733"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756692963427,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543745237091,"product_id":7892665172067,"position":7,"created_at":"2025-10-02T10:05:36+08:00","updated_at":"2025-10-02T10:05:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738","variant_ids":[43756692963427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113500119139,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d936d3f711161cce6a250d5e6b873d730184ff5.webp?v=1759370738"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43756689391715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR04","requires_shipping":true,"taxable":true,"featured_image":{"id":34543743271011,"product_id":7892665172067,"position":1,"created_at":"2025-10-02T10:05:30+08:00","updated_at":"2025-10-02T10:05:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732","variant_ids":[43756689391715]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Yin\u0026Yang - 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-AAR04","featured_media":{"alt":null,"id":26113498153059,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1adad466fb26b4c12f292bb451331597b38163b7.webp?v=1759370732"}},"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: "停產"
}