$product = {"id":7892122861667,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢","handle":"iphone-12-pro-mod-nx-magsafe-printable-fw56","description":null,"published_at":"2025-10-01T12:20:14+08:00","created_at":"2025-10-01T09:36:26+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-xiuxiubear","device-iPhone 12 Pro","merge","reseller-xiuxiubear"],"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":43754568122467,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851036259,"product_id":7892122861667,"position":3,"created_at":"2025-10-01T09:36:32+08:00","updated_at":"2025-10-01T09:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594","variant_ids":[43754568122467]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618173539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754570776675,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540850905187,"product_id":7892122861667,"position":2,"created_at":"2025-10-01T09:36:31+08:00","updated_at":"2025-10-01T09:36:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593","variant_ids":[43754570776675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618042467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754570940515,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851298403,"product_id":7892122861667,"position":5,"created_at":"2025-10-01T09:36:33+08:00","updated_at":"2025-10-01T09:36:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595","variant_ids":[43754570940515]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618435683,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754571006051,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851167331,"product_id":7892122861667,"position":4,"created_at":"2025-10-01T09:36:32+08:00","updated_at":"2025-10-01T09:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594","variant_ids":[43754571006051]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618304611,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754571071587,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851495011,"product_id":7892122861667,"position":9,"created_at":"2025-10-01T09:36:35+08:00","updated_at":"2025-10-01T09:36:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597","variant_ids":[43754571071587]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618632291,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cc16afcd9776e1c67e514652afcd6d02295fe8.webp?v=1759282593","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28b80a23aee8a80d506c059dccc8eef1ad89d687.webp?v=1759282595","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2391bdadb56033bb90a39194cbe6be31c5a4e1c2.webp?v=1759282596","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d637a051f721b4155a3449c2443068bf66fcb5df.webp?v=1759282597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b89f55ac0cfd41b33661ad7dfb49368301e9a956.webp?v=1759282598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a1a81bafacd6bc509552095ded5efb83e447ceef.webp?v=1759282598"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cc16afcd9776e1c67e514652afcd6d02295fe8.webp?v=1759282593","options":["color"],"media":[{"alt":null,"id":26110617878627,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cc16afcd9776e1c67e514652afcd6d02295fe8.webp?v=1759282593"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cc16afcd9776e1c67e514652afcd6d02295fe8.webp?v=1759282593","width":2000},{"alt":null,"id":26110618042467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593","width":2000},{"alt":null,"id":26110618173539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594","width":2000},{"alt":null,"id":26110618304611,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594","width":2000},{"alt":null,"id":26110618435683,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595","width":2000},{"alt":null,"id":26110618468451,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28b80a23aee8a80d506c059dccc8eef1ad89d687.webp?v=1759282595"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28b80a23aee8a80d506c059dccc8eef1ad89d687.webp?v=1759282595","width":2000},{"alt":null,"id":26110618501219,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2391bdadb56033bb90a39194cbe6be31c5a4e1c2.webp?v=1759282596"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2391bdadb56033bb90a39194cbe6be31c5a4e1c2.webp?v=1759282596","width":2000},{"alt":null,"id":26110618566755,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d637a051f721b4155a3449c2443068bf66fcb5df.webp?v=1759282597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d637a051f721b4155a3449c2443068bf66fcb5df.webp?v=1759282597","width":2000},{"alt":null,"id":26110618632291,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597","width":2000},{"alt":null,"id":26110618665059,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b89f55ac0cfd41b33661ad7dfb49368301e9a956.webp?v=1759282598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b89f55ac0cfd41b33661ad7dfb49368301e9a956.webp?v=1759282598","width":2000},{"alt":null,"id":26110618697827,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a1a81bafacd6bc509552095ded5efb83e447ceef.webp?v=1759282598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a1a81bafacd6bc509552095ded5efb83e447ceef.webp?v=1759282598","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43754568122467,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851036259,"product_id":7892122861667,"position":3,"created_at":"2025-10-01T09:36:32+08:00","updated_at":"2025-10-01T09:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594","variant_ids":[43754568122467]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618173539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754570776675,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540850905187,"product_id":7892122861667,"position":2,"created_at":"2025-10-01T09:36:31+08:00","updated_at":"2025-10-01T09:36:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593","variant_ids":[43754570776675]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618042467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f39a261c971ae8fb7dbd4be89f628616f8cac063.webp?v=1759282593"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754570940515,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851298403,"product_id":7892122861667,"position":5,"created_at":"2025-10-01T09:36:33+08:00","updated_at":"2025-10-01T09:36:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595","variant_ids":[43754570940515]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618435683,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88d8497fbb0d919a75b52e9ae907bccc363ed5c4.webp?v=1759282595"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754571006051,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851167331,"product_id":7892122861667,"position":4,"created_at":"2025-10-01T09:36:32+08:00","updated_at":"2025-10-01T09:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594","variant_ids":[43754571006051]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618304611,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd33efcfdca6623119c3ed179bf80d7ccb5d6045.webp?v=1759282594"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43754571071587,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851495011,"product_id":7892122861667,"position":9,"created_at":"2025-10-01T09:36:35+08:00","updated_at":"2025-10-01T09:36:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597","variant_ids":[43754571071587]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618632291,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09be8605234b4390d7302a03aefff72ed4a6e571.webp?v=1759282597"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43754568122467,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FW56","requires_shipping":true,"taxable":true,"featured_image":{"id":34540851036259,"product_id":7892122861667,"position":3,"created_at":"2025-10-01T09:36:32+08:00","updated_at":"2025-10-01T09:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594","variant_ids":[43754568122467]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 咻咻熊 做一個好夢 - 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-FW56","featured_media":{"alt":null,"id":26110618173539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7042f2967cad70e3274f477de989eec2a5b540d3.webp?v=1759282594"}},"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: "停產"
}