$product = {"id":7769704497251,"title":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself","handle":"iphone-xr-mod-nx-printable-xf47","description":null,"published_at":"2025-07-16T17:07:06+08:00","created_at":"2025-04-15T19:43:33+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX專區-I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone XR","merge","reseller-ilovedoodle"],"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":43303607009379,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197591457891,"product_id":7769704497251,"position":2,"created_at":"2025-07-16T15:09:48+08:00","updated_at":"2025-07-16T15:09:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790","variant_ids":[43303607009379]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF47","featured_media":{"alt":null,"id":25829980930147,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303612973155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197592834147,"product_id":7769704497251,"position":6,"created_at":"2025-07-16T15:09:50+08:00","updated_at":"2025-07-16T15:09:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792","variant_ids":[43303612973155]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108504-XF47","featured_media":{"alt":null,"id":25829981716579,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303613071459,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197592572003,"product_id":7769704497251,"position":5,"created_at":"2025-07-16T15:09:50+08:00","updated_at":"2025-07-16T15:09:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792","variant_ids":[43303613071459]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108515-XF47","featured_media":{"alt":null,"id":25829981552739,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303613104227,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197591949411,"product_id":7769704497251,"position":3,"created_at":"2025-07-16T15:09:49+08:00","updated_at":"2025-07-16T15:09:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791","variant_ids":[43303613104227]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01085C1-XF47","featured_media":{"alt":null,"id":25829981159523,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a609e787c570bcf264b835819793fcc42312271.webp?v=1744717419","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4372c87428f3ab6454959a311f48cf91ad0c8101_e100c04d-7794-48ed-8553-59009f1afe8f.webp?v=1752649791","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa31c4545dc1fd315484cf1b412a813c3ab9832e_600ade9f-16c6-4047-ab61-dc7ece770f70.webp?v=1752649792","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d66345cac31ce70e10eace95fcec546c0c2ca83_0c71ba02-b98a-413d-b265-db8670075947.webp?v=1752649793","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c186dda74a4c93cec070f9af056471814b6b134c_b5fb8034-205a-494e-81aa-3ef82638ff65.webp?v=1752649794","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb653039062865a8ad1ced8f25480e38e60a5516_aad67081-605e-4a0a-9f7d-579d4f7e4468.webp?v=1752649794","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9b1971145d3a7504be8f7a597d788767aa84d7d_64f0f888-6c71-487c-baf9-c42e88d68711.webp?v=1752649795"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a609e787c570bcf264b835819793fcc42312271.webp?v=1744717419","options":["color"],"media":[{"alt":null,"id":25496147198051,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a609e787c570bcf264b835819793fcc42312271.webp?v=1744717419"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a609e787c570bcf264b835819793fcc42312271.webp?v=1744717419","width":2000},{"alt":null,"id":25829980930147,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790","width":2000},{"alt":null,"id":25829981159523,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791","width":2000},{"alt":null,"id":25829981323363,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4372c87428f3ab6454959a311f48cf91ad0c8101_e100c04d-7794-48ed-8553-59009f1afe8f.webp?v=1752649791"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4372c87428f3ab6454959a311f48cf91ad0c8101_e100c04d-7794-48ed-8553-59009f1afe8f.webp?v=1752649791","width":2000},{"alt":null,"id":25829981552739,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792","width":2000},{"alt":null,"id":25829981716579,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792","width":2000},{"alt":null,"id":25829981847651,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa31c4545dc1fd315484cf1b412a813c3ab9832e_600ade9f-16c6-4047-ab61-dc7ece770f70.webp?v=1752649792"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa31c4545dc1fd315484cf1b412a813c3ab9832e_600ade9f-16c6-4047-ab61-dc7ece770f70.webp?v=1752649792","width":2000},{"alt":null,"id":25829981978723,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d66345cac31ce70e10eace95fcec546c0c2ca83_0c71ba02-b98a-413d-b265-db8670075947.webp?v=1752649793"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d66345cac31ce70e10eace95fcec546c0c2ca83_0c71ba02-b98a-413d-b265-db8670075947.webp?v=1752649793","width":2000},{"alt":null,"id":25829982109795,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c186dda74a4c93cec070f9af056471814b6b134c_b5fb8034-205a-494e-81aa-3ef82638ff65.webp?v=1752649794"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c186dda74a4c93cec070f9af056471814b6b134c_b5fb8034-205a-494e-81aa-3ef82638ff65.webp?v=1752649794","width":2000},{"alt":null,"id":25829982306403,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb653039062865a8ad1ced8f25480e38e60a5516_aad67081-605e-4a0a-9f7d-579d4f7e4468.webp?v=1752649794"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb653039062865a8ad1ced8f25480e38e60a5516_aad67081-605e-4a0a-9f7d-579d4f7e4468.webp?v=1752649794","width":2000},{"alt":null,"id":25829982568547,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9b1971145d3a7504be8f7a597d788767aa84d7d_64f0f888-6c71-487c-baf9-c42e88d68711.webp?v=1752649795"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9b1971145d3a7504be8f7a597d788767aa84d7d_64f0f888-6c71-487c-baf9-c42e88d68711.webp?v=1752649795","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43303607009379,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197591457891,"product_id":7769704497251,"position":2,"created_at":"2025-07-16T15:09:48+08:00","updated_at":"2025-07-16T15:09:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790","variant_ids":[43303607009379]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF47","featured_media":{"alt":null,"id":25829980930147,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303612973155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197592834147,"product_id":7769704497251,"position":6,"created_at":"2025-07-16T15:09:50+08:00","updated_at":"2025-07-16T15:09:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792","variant_ids":[43303612973155]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108504-XF47","featured_media":{"alt":null,"id":25829981716579,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e45f8ca114377c1b54d3d9398ff5b1870f79b51_647ece14-54a5-435d-8f12-270d3450e06a.webp?v=1752649792"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303613071459,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197592572003,"product_id":7769704497251,"position":5,"created_at":"2025-07-16T15:09:50+08:00","updated_at":"2025-07-16T15:09:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792","variant_ids":[43303613071459]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108515-XF47","featured_media":{"alt":null,"id":25829981552739,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/104bd798950e059b1523cb5cfeb25f423060db29_f17f588b-e336-467d-80ff-5532dc91ad44.webp?v=1752649792"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303613104227,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197591949411,"product_id":7769704497251,"position":3,"created_at":"2025-07-16T15:09:49+08:00","updated_at":"2025-07-16T15:09:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791","variant_ids":[43303613104227]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01085C1-XF47","featured_media":{"alt":null,"id":25829981159523,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e96130502ebd53175d0797a7a89385a5ad4c252f_19c76f81-c785-43fb-afec-d0034c5c3e56.webp?v=1752649791"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43303607009379,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197591457891,"product_id":7769704497251,"position":2,"created_at":"2025-07-16T15:09:48+08:00","updated_at":"2025-07-16T15:09:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790","variant_ids":[43303607009379]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Mindful Cat - Love Yourself - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF47","featured_media":{"alt":null,"id":25829980930147,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecbe24e6bffa859cb45b37246f3bd6467b4654a8_c4430a55-5b53-4bd2-8210-c01770a69bf1.webp?v=1752649790"}},"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: "停產"
}