$product = {"id":7876176019555,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就","handle":"iphone-12-pro-mod-nx-magsafe-printable-eb78","description":null,"published_at":"2025-09-04T09:13:02+08:00","created_at":"2025-09-03T12:21:28+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-byebyechuchu","device-iPhone 12 Pro","merge","reseller-byebyechuchu"],"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":43675721302115,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416691314787,"product_id":7876176019555,"position":7,"created_at":"2025-09-03T12:21:36+08:00","updated_at":"2025-09-03T12:21:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298","variant_ids":[43675721302115]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965924963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725135971,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690724963,"product_id":7876176019555,"position":3,"created_at":"2025-09-03T12:21:33+08:00","updated_at":"2025-09-03T12:21:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295","variant_ids":[43675725135971]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965335139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725201507,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690298979,"product_id":7876176019555,"position":1,"created_at":"2025-09-03T12:21:31+08:00","updated_at":"2025-09-03T12:21:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293","variant_ids":[43675725201507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988964909155,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725299811,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416691937379,"product_id":7876176019555,"position":11,"created_at":"2025-09-03T12:21:39+08:00","updated_at":"2025-09-03T12:21:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301","variant_ids":[43675725299811]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988966547555,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725398115,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690528355,"product_id":7876176019555,"position":2,"created_at":"2025-09-03T12:21:32+08:00","updated_at":"2025-09-03T12:21:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294","variant_ids":[43675725398115]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965138531,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d320bb95231f14cb3d59cabedb78bda5700a7324.webp?v=1756873296","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f39c46d142c9c0056fa3b9b9bcc2341b5b57c88.webp?v=1756873296","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/161e42471674b10da16116efb5f06671faaf6808.webp?v=1756873297","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e8c1d15335079244b0675e582ae55cb73da.webp?v=1756873299","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1059f2a0bfbc22bc8c505196461ae7f610ea843f.webp?v=1756873299","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a485a5bd351cfa8238b47a140d681e969bd2f6fc.webp?v=1756873300","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293","options":["color"],"media":[{"alt":null,"id":25988964909155,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293","width":2000},{"alt":null,"id":25988965138531,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294","width":2000},{"alt":null,"id":25988965335139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295","width":2000},{"alt":null,"id":25988965466211,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d320bb95231f14cb3d59cabedb78bda5700a7324.webp?v=1756873296"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d320bb95231f14cb3d59cabedb78bda5700a7324.webp?v=1756873296","width":2000},{"alt":null,"id":25988965728355,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f39c46d142c9c0056fa3b9b9bcc2341b5b57c88.webp?v=1756873296"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f39c46d142c9c0056fa3b9b9bcc2341b5b57c88.webp?v=1756873296","width":2000},{"alt":null,"id":25988965826659,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/161e42471674b10da16116efb5f06671faaf6808.webp?v=1756873297"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/161e42471674b10da16116efb5f06671faaf6808.webp?v=1756873297","width":2000},{"alt":null,"id":25988965924963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298","width":2000},{"alt":null,"id":25988966023267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e8c1d15335079244b0675e582ae55cb73da.webp?v=1756873299"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e8c1d15335079244b0675e582ae55cb73da.webp?v=1756873299","width":2000},{"alt":null,"id":25988966154339,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1059f2a0bfbc22bc8c505196461ae7f610ea843f.webp?v=1756873299"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1059f2a0bfbc22bc8c505196461ae7f610ea843f.webp?v=1756873299","width":2000},{"alt":null,"id":25988966350947,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a485a5bd351cfa8238b47a140d681e969bd2f6fc.webp?v=1756873300"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a485a5bd351cfa8238b47a140d681e969bd2f6fc.webp?v=1756873300","width":2000},{"alt":null,"id":25988966547555,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43675721302115,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416691314787,"product_id":7876176019555,"position":7,"created_at":"2025-09-03T12:21:36+08:00","updated_at":"2025-09-03T12:21:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298","variant_ids":[43675721302115]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965924963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725135971,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690724963,"product_id":7876176019555,"position":3,"created_at":"2025-09-03T12:21:33+08:00","updated_at":"2025-09-03T12:21:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295","variant_ids":[43675725135971]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965335139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ba7e3fbc2bfca831221909d82fd0866789c242f.webp?v=1756873295"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725201507,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690298979,"product_id":7876176019555,"position":1,"created_at":"2025-09-03T12:21:31+08:00","updated_at":"2025-09-03T12:21:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293","variant_ids":[43675725201507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988964909155,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f94753a4801926f0bed3a808b90361913e34ae36.webp?v=1756873293"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725299811,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416691937379,"product_id":7876176019555,"position":11,"created_at":"2025-09-03T12:21:39+08:00","updated_at":"2025-09-03T12:21:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301","variant_ids":[43675725299811]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988966547555,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f5f3ed153811a73ca2a6c40417daae27dcc224.webp?v=1756873301"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43675725398115,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416690528355,"product_id":7876176019555,"position":2,"created_at":"2025-09-03T12:21:32+08:00","updated_at":"2025-09-03T12:21:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294","variant_ids":[43675725398115]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965138531,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b7a60575965820069eedfe77d51510258cbbc93.webp?v=1756873294"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43675721302115,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EB78","requires_shipping":true,"taxable":true,"featured_image":{"id":34416691314787,"product_id":7876176019555,"position":7,"created_at":"2025-09-03T12:21:36+08:00","updated_at":"2025-09-03T12:21:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298","variant_ids":[43675721302115]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 奧樂雞 OLOGY 戀愛成就 - 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-EB78","featured_media":{"alt":null,"id":25988965924963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8147f701d33a120e085a3683f8de5a159e7c753.webp?v=1756873298"}},"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: "停產"
}