$product = {"id":7876019093603,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 小勞撫 不關我的事","handle":"iphone-12-pro-mod-nx-magsafe-printable-em49","description":null,"published_at":"2025-09-04T10:27:47+08:00","created_at":"2025-09-03T11:39:04+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-xiaolaofu","device-iPhone 12 Pro","merge","reseller-xiaolaofu"],"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":43674990575715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038674531,"product_id":7876019093603,"position":2,"created_at":"2025-09-03T11:39:09+08:00","updated_at":"2025-09-03T11:39:11+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751","variant_ids":[43674990575715]},"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-EM49","featured_media":{"alt":null,"id":25988313514083,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996637795,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416040575075,"product_id":7876019093603,"position":11,"created_at":"2025-09-03T11:39:16+08:00","updated_at":"2025-09-03T11:39:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758","variant_ids":[43674996637795]},"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-EM49","featured_media":{"alt":null,"id":25988315414627,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996703331,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416039559267,"product_id":7876019093603,"position":7,"created_at":"2025-09-03T11:39:13+08:00","updated_at":"2025-09-03T11:39:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755","variant_ids":[43674996703331]},"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-EM49","featured_media":{"alt":null,"id":25988314398819,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996801635,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038838371,"product_id":7876019093603,"position":3,"created_at":"2025-09-03T11:39:10+08:00","updated_at":"2025-09-03T11:39:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752","variant_ids":[43674996801635]},"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-EM49","featured_media":{"alt":null,"id":25988313677923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996899939,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038543459,"product_id":7876019093603,"position":1,"created_at":"2025-09-03T11:39:08+08:00","updated_at":"2025-09-03T11:39:10+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750","variant_ids":[43674996899939]},"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-EM49","featured_media":{"alt":null,"id":25988313383011,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecc8506c3aa6f471548951cffccefc8121e1a7ff.webp?v=1756870752","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79a6b7b0d06af67a1ef257add5fc3908285b7c4c.webp?v=1756870753","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61c41d156435d2bf5cb6905285aad19f40f745ed.webp?v=1756870754","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e214503b2fe67535eab7b0c16bcecee3013061c5.webp?v=1756870755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ece42c56386f256039af206cf1a9475e08aa55b.webp?v=1756870756","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6548aa8aba4901aac9bfae679822d0b3f1896869.webp?v=1756870757","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750","options":["color"],"media":[{"alt":null,"id":25988313383011,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750","width":2000},{"alt":null,"id":25988313514083,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751","width":2000},{"alt":null,"id":25988313677923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752","width":2000},{"alt":null,"id":25988313808995,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecc8506c3aa6f471548951cffccefc8121e1a7ff.webp?v=1756870752"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecc8506c3aa6f471548951cffccefc8121e1a7ff.webp?v=1756870752","width":2000},{"alt":null,"id":25988313972835,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79a6b7b0d06af67a1ef257add5fc3908285b7c4c.webp?v=1756870753"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79a6b7b0d06af67a1ef257add5fc3908285b7c4c.webp?v=1756870753","width":2000},{"alt":null,"id":25988314202211,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61c41d156435d2bf5cb6905285aad19f40f745ed.webp?v=1756870754"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61c41d156435d2bf5cb6905285aad19f40f745ed.webp?v=1756870754","width":2000},{"alt":null,"id":25988314398819,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755","width":2000},{"alt":null,"id":25988314595427,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e214503b2fe67535eab7b0c16bcecee3013061c5.webp?v=1756870755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e214503b2fe67535eab7b0c16bcecee3013061c5.webp?v=1756870755","width":2000},{"alt":null,"id":25988314792035,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ece42c56386f256039af206cf1a9475e08aa55b.webp?v=1756870756"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ece42c56386f256039af206cf1a9475e08aa55b.webp?v=1756870756","width":2000},{"alt":null,"id":25988315119715,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6548aa8aba4901aac9bfae679822d0b3f1896869.webp?v=1756870757"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6548aa8aba4901aac9bfae679822d0b3f1896869.webp?v=1756870757","width":2000},{"alt":null,"id":25988315414627,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43674990575715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038674531,"product_id":7876019093603,"position":2,"created_at":"2025-09-03T11:39:09+08:00","updated_at":"2025-09-03T11:39:11+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751","variant_ids":[43674990575715]},"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-EM49","featured_media":{"alt":null,"id":25988313514083,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996637795,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416040575075,"product_id":7876019093603,"position":11,"created_at":"2025-09-03T11:39:16+08:00","updated_at":"2025-09-03T11:39:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758","variant_ids":[43674996637795]},"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-EM49","featured_media":{"alt":null,"id":25988315414627,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59699f2525c19f2cedd817ff63115f95f0a12d82.webp?v=1756870758"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996703331,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416039559267,"product_id":7876019093603,"position":7,"created_at":"2025-09-03T11:39:13+08:00","updated_at":"2025-09-03T11:39:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755","variant_ids":[43674996703331]},"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-EM49","featured_media":{"alt":null,"id":25988314398819,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9761733fe38ce1d1e870e31ed2cf0f2ae117af3.webp?v=1756870755"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996801635,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038838371,"product_id":7876019093603,"position":3,"created_at":"2025-09-03T11:39:10+08:00","updated_at":"2025-09-03T11:39:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752","variant_ids":[43674996801635]},"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-EM49","featured_media":{"alt":null,"id":25988313677923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d496d4ac64f52b9a0b1e10db36eda57ace4e1d4b.webp?v=1756870752"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43674996899939,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038543459,"product_id":7876019093603,"position":1,"created_at":"2025-09-03T11:39:08+08:00","updated_at":"2025-09-03T11:39:10+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750","variant_ids":[43674996899939]},"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-EM49","featured_media":{"alt":null,"id":25988313383011,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c2f3edfa9c77f66e4972f7091c3eab436820976.webp?v=1756870750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43674990575715,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-EM49","requires_shipping":true,"taxable":true,"featured_image":{"id":34416038674531,"product_id":7876019093603,"position":2,"created_at":"2025-09-03T11:39:09+08:00","updated_at":"2025-09-03T11:39:11+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751","variant_ids":[43674990575715]},"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-EM49","featured_media":{"alt":null,"id":25988313514083,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79096a11f42bcff247f8b5864b298807f6615e10.webp?v=1756870751"}},"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: "停產"
}