$product = {"id":7769776914531,"title":"iPhone XR Mod NX ilovedoodle Cat People - 貓派","handle":"iphone-xr-mod-nx-printable-xf54","description":null,"published_at":"2025-07-16T17:00:20+08:00","created_at":"2025-04-15T20:28:36+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":43303916568675,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196582400099,"product_id":7769776914531,"position":11,"created_at":"2025-07-16T14:46:36+08:00","updated_at":"2025-07-16T14:46:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398","variant_ids":[43303916568675]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829433376867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922303075,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196580237411,"product_id":7769776914531,"position":7,"created_at":"2025-07-16T14:46:34+08:00","updated_at":"2025-07-16T14:46:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396","variant_ids":[43303922303075]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829432131683,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922401379,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196580204643,"product_id":7769776914531,"position":6,"created_at":"2025-07-16T14:46:34+08:00","updated_at":"2025-07-16T14:46:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396","variant_ids":[43303922401379]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829431869539,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922434147,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196579024995,"product_id":7769776914531,"position":5,"created_at":"2025-07-16T14:46:33+08:00","updated_at":"2025-07-16T14:46:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395","variant_ids":[43303922434147]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829431640163,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/043affcb1e17fdc1117085ef731128163e8bd323.webp?v=1744720123","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/accf7dc46c31eed5a6d5be620bbe8c2f1b3891a8_590cd6c6-da00-4687-a790-cb478f64e918.webp?v=1752648393","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63ba62e6708f5645e6483d752cb25ad97318d318_bcaf1921-bf65-4834-bab7-97aa7cb18a93.webp?v=1752648394","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/023731de08c799190eec4fd274e8c8ff4bc6423a_3cd7131f-d6ce-4881-a8ba-7aaffe5baa99.webp?v=1752648395","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbfd77ecf123c8937a8f3f3c20ea7fb761fb78ba_81b681e5-701a-445d-bb6e-13250733b5bf.webp?v=1752648396","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a414caaccae98affb244ed10c3e570ce352d57b_5c642bfa-bf12-4862-b790-9078163826e8.webp?v=1752648397","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9591bdc9a17d418311e85a2819ebb6e2d6d6669_9cebc582-26b1-427f-b8dd-c1ccc3713c36.webp?v=1752648398","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/043affcb1e17fdc1117085ef731128163e8bd323.webp?v=1744720123","options":["color"],"media":[{"alt":null,"id":25496269652067,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/043affcb1e17fdc1117085ef731128163e8bd323.webp?v=1744720123"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/043affcb1e17fdc1117085ef731128163e8bd323.webp?v=1744720123","width":2000},{"alt":null,"id":25829430952035,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/accf7dc46c31eed5a6d5be620bbe8c2f1b3891a8_590cd6c6-da00-4687-a790-cb478f64e918.webp?v=1752648393"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/accf7dc46c31eed5a6d5be620bbe8c2f1b3891a8_590cd6c6-da00-4687-a790-cb478f64e918.webp?v=1752648393","width":2000},{"alt":null,"id":25829431083107,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63ba62e6708f5645e6483d752cb25ad97318d318_bcaf1921-bf65-4834-bab7-97aa7cb18a93.webp?v=1752648394"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63ba62e6708f5645e6483d752cb25ad97318d318_bcaf1921-bf65-4834-bab7-97aa7cb18a93.webp?v=1752648394","width":2000},{"alt":null,"id":25829431410787,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/023731de08c799190eec4fd274e8c8ff4bc6423a_3cd7131f-d6ce-4881-a8ba-7aaffe5baa99.webp?v=1752648395"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/023731de08c799190eec4fd274e8c8ff4bc6423a_3cd7131f-d6ce-4881-a8ba-7aaffe5baa99.webp?v=1752648395","width":2000},{"alt":null,"id":25829431640163,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395","width":2000},{"alt":null,"id":25829431869539,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396","width":2000},{"alt":null,"id":25829432131683,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396","width":2000},{"alt":null,"id":25829432393827,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbfd77ecf123c8937a8f3f3c20ea7fb761fb78ba_81b681e5-701a-445d-bb6e-13250733b5bf.webp?v=1752648396"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbfd77ecf123c8937a8f3f3c20ea7fb761fb78ba_81b681e5-701a-445d-bb6e-13250733b5bf.webp?v=1752648396","width":2000},{"alt":null,"id":25829432623203,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a414caaccae98affb244ed10c3e570ce352d57b_5c642bfa-bf12-4862-b790-9078163826e8.webp?v=1752648397"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a414caaccae98affb244ed10c3e570ce352d57b_5c642bfa-bf12-4862-b790-9078163826e8.webp?v=1752648397","width":2000},{"alt":null,"id":25829433180259,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9591bdc9a17d418311e85a2819ebb6e2d6d6669_9cebc582-26b1-427f-b8dd-c1ccc3713c36.webp?v=1752648398"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9591bdc9a17d418311e85a2819ebb6e2d6d6669_9cebc582-26b1-427f-b8dd-c1ccc3713c36.webp?v=1752648398","width":2000},{"alt":null,"id":25829433376867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43303916568675,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196582400099,"product_id":7769776914531,"position":11,"created_at":"2025-07-16T14:46:36+08:00","updated_at":"2025-07-16T14:46:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398","variant_ids":[43303916568675]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829433376867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922303075,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196580237411,"product_id":7769776914531,"position":7,"created_at":"2025-07-16T14:46:34+08:00","updated_at":"2025-07-16T14:46:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396","variant_ids":[43303922303075]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829432131683,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97f1a07cff4756cbce8aedc2ecab770794d7a05b_61065b1a-891f-4b28-b41f-60c744e1ee76.webp?v=1752648396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922401379,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196580204643,"product_id":7769776914531,"position":6,"created_at":"2025-07-16T14:46:34+08:00","updated_at":"2025-07-16T14:46:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396","variant_ids":[43303922401379]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829431869539,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377d52c4979675b8cd2ad7af85d05949b4ca4f42_bd8a76b6-bc24-4bb0-bdb8-a2e4518c1609.webp?v=1752648396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303922434147,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196579024995,"product_id":7769776914531,"position":5,"created_at":"2025-07-16T14:46:33+08:00","updated_at":"2025-07-16T14:46:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395","variant_ids":[43303922434147]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829431640163,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8aaeb53a964902114e02f1a87829853b2a548732_1a828e85-d52e-4f7d-9b0b-766cf5c4bfad.webp?v=1752648395"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43303916568675,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34196582400099,"product_id":7769776914531,"position":11,"created_at":"2025-07-16T14:46:36+08:00","updated_at":"2025-07-16T14:46:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398","variant_ids":[43303916568675]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat People - 貓派 - 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-XF54","featured_media":{"alt":null,"id":25829433376867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3ce3fad53daa2d4c6a28c3082d2f0761d2a541c_f8814787-6d2b-4d5f-941d-b7cefbd981bd.webp?v=1752648398"}},"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: "停產"
}