$product = {"id":7769573589091,"title":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵","handle":"iphone-xr-mod-nx-printable-xf49","description":null,"published_at":"2025-07-16T17:22:17+08:00","created_at":"2025-04-15T17:56:14+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":43302992380003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196860567651,"product_id":7769573589091,"position":2,"created_at":"2025-07-16T14:52:57+08:00","updated_at":"2025-07-16T14:52:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779","variant_ids":[43302992380003]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829584601187,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997065827,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196863123555,"product_id":7769573589091,"position":5,"created_at":"2025-07-16T14:53:00+08:00","updated_at":"2025-07-16T14:53:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781","variant_ids":[43302997065827]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829585616995,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997164131,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196865417315,"product_id":7769573589091,"position":10,"created_at":"2025-07-16T14:53:02+08:00","updated_at":"2025-07-16T14:53:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784","variant_ids":[43302997164131]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829587222627,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997196899,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196864925795,"product_id":7769573589091,"position":8,"created_at":"2025-07-16T14:53:01+08:00","updated_at":"2025-07-16T14:53:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783","variant_ids":[43302997196899]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829586829411,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73ac4429ed3a701aff5b886d715643eeb5918e54.webp?v=1744710981","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/388d818543ea14f723d5cf9f6acc9dc2e3eedf89_f56346d0-8ce4-4380-9e83-ac5dac680d08.webp?v=1752648780","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd4046867aadd5b1d8d9923989f566f08dfe80eb_02d282a7-b3e3-4997-b12d-23b98b0a5861.webp?v=1752648780","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/20883a49169e0efa42b6f39785bae0773ec28ec4_24e6d357-2ddb-46b7-a6a5-1ed820c39b2d.webp?v=1752648782","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cd786032f3195af22ad89b9e416770c620cb34_d9bfa2e9-246e-49e7-92c1-6ab5df4fa01a.webp?v=1752648782","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd5b6b64d4cfd596e3f27365f3df2ba0cf373451_9aa45cb1-1da0-472e-a895-053d08a0e0bd.webp?v=1752648783","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/29f3a696b2963448dbbf5d23522ef81595b3435a_48d4d7d4-d323-4c18-a282-2ab699c4bd9e.webp?v=1752648785"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73ac4429ed3a701aff5b886d715643eeb5918e54.webp?v=1744710981","options":["color"],"media":[{"alt":null,"id":25495846944867,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73ac4429ed3a701aff5b886d715643eeb5918e54.webp?v=1744710981"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73ac4429ed3a701aff5b886d715643eeb5918e54.webp?v=1744710981","width":2000},{"alt":null,"id":25829584601187,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779","width":2000},{"alt":null,"id":25829584863331,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/388d818543ea14f723d5cf9f6acc9dc2e3eedf89_f56346d0-8ce4-4380-9e83-ac5dac680d08.webp?v=1752648780"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/388d818543ea14f723d5cf9f6acc9dc2e3eedf89_f56346d0-8ce4-4380-9e83-ac5dac680d08.webp?v=1752648780","width":2000},{"alt":null,"id":25829585256547,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd4046867aadd5b1d8d9923989f566f08dfe80eb_02d282a7-b3e3-4997-b12d-23b98b0a5861.webp?v=1752648780"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd4046867aadd5b1d8d9923989f566f08dfe80eb_02d282a7-b3e3-4997-b12d-23b98b0a5861.webp?v=1752648780","width":2000},{"alt":null,"id":25829585616995,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781","width":2000},{"alt":null,"id":25829585944675,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/20883a49169e0efa42b6f39785bae0773ec28ec4_24e6d357-2ddb-46b7-a6a5-1ed820c39b2d.webp?v=1752648782"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/20883a49169e0efa42b6f39785bae0773ec28ec4_24e6d357-2ddb-46b7-a6a5-1ed820c39b2d.webp?v=1752648782","width":2000},{"alt":null,"id":25829586403427,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cd786032f3195af22ad89b9e416770c620cb34_d9bfa2e9-246e-49e7-92c1-6ab5df4fa01a.webp?v=1752648782"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/65cd786032f3195af22ad89b9e416770c620cb34_d9bfa2e9-246e-49e7-92c1-6ab5df4fa01a.webp?v=1752648782","width":2000},{"alt":null,"id":25829586829411,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783","width":2000},{"alt":null,"id":25829587058787,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd5b6b64d4cfd596e3f27365f3df2ba0cf373451_9aa45cb1-1da0-472e-a895-053d08a0e0bd.webp?v=1752648783"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd5b6b64d4cfd596e3f27365f3df2ba0cf373451_9aa45cb1-1da0-472e-a895-053d08a0e0bd.webp?v=1752648783","width":2000},{"alt":null,"id":25829587222627,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784","width":2000},{"alt":null,"id":25829587452003,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/29f3a696b2963448dbbf5d23522ef81595b3435a_48d4d7d4-d323-4c18-a282-2ab699c4bd9e.webp?v=1752648785"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/29f3a696b2963448dbbf5d23522ef81595b3435a_48d4d7d4-d323-4c18-a282-2ab699c4bd9e.webp?v=1752648785","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43302992380003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196860567651,"product_id":7769573589091,"position":2,"created_at":"2025-07-16T14:52:57+08:00","updated_at":"2025-07-16T14:52:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779","variant_ids":[43302992380003]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829584601187,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997065827,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196863123555,"product_id":7769573589091,"position":5,"created_at":"2025-07-16T14:53:00+08:00","updated_at":"2025-07-16T14:53:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781","variant_ids":[43302997065827]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829585616995,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11559eadf24c0e23a4eeab94a2cb37facd86a48d_87ceee90-a83c-41bd-afdc-b66e10b6e6f3.webp?v=1752648781"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997164131,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196865417315,"product_id":7769573589091,"position":10,"created_at":"2025-07-16T14:53:02+08:00","updated_at":"2025-07-16T14:53:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784","variant_ids":[43302997164131]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829587222627,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f14286c882cfa1f15069a4bb4a78cd0c0256adff_cfa40801-29d5-4528-bb2d-3d71b07fa551.webp?v=1752648784"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302997196899,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196864925795,"product_id":7769573589091,"position":8,"created_at":"2025-07-16T14:53:01+08:00","updated_at":"2025-07-16T14:53:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783","variant_ids":[43302997196899]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829586829411,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d154f10a0da6a2140a64b998149a0b0f21d0538a_a6a88583-065d-41c9-9f29-8ece52ec2e9c.webp?v=1752648783"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43302992380003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34196860567651,"product_id":7769573589091,"position":2,"created_at":"2025-07-16T14:52:57+08:00","updated_at":"2025-07-16T14:52:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779","variant_ids":[43302992380003]},"available":true,"name":"iPhone XR Mod NX ilovedoodle White Cat Flowers - 白貓花朵 - 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-XF49","featured_media":{"alt":null,"id":25829584601187,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51d5fe232b63fa73792fff4a2c14a35c3f345221_604bf516-a128-4013-ad56-0783565a8b18.webp?v=1752648779"}},"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: "停產"
}