$product = {"id":7770020577379,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf57","description":null,"published_at":"2025-04-16T12:45:47+08:00","created_at":"2025-04-15T23:24:17+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX MagSafe專區I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone 14 Pro","merge","reseller-ilovedoodle"],"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":43305093333091,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721645155,"product_id":7770020577379,"position":8,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497","variant_ids":[43305093333091]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF57","featured_media":{"alt":null,"id":25830067208291,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305099853923,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197715091555,"product_id":7770020577379,"position":2,"created_at":"2025-07-16T15:21:31+08:00","updated_at":"2025-07-16T15:21:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493","variant_ids":[43305099853923]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF57","featured_media":{"alt":null,"id":25830064062563,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305100017763,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197719875683,"product_id":7770020577379,"position":6,"created_at":"2025-07-16T15:21:34+08:00","updated_at":"2025-07-16T15:21:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496","variant_ids":[43305100017763]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - 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":"MPB01262J5-XF57","featured_media":{"alt":null,"id":25830066192483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/679fb6b22bc507a1ab6bf8ce2c10622906c81234_ac3b616c-0265-4e75-aad9-a1b1871e05fe.webp?v=1744730664","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d55a28b5c622da9c942eb5d7fa35776fe95424a3_9c9cfaa0-73f5-4466-acf6-ab6c4cfee757.webp?v=1752650494","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b1eb3c8a87d99b2bca8b680b60d0e52aea8b6b9a_10df5288-16a6-430a-9c24-10e7dee75cc4.webp?v=1752650495","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813feacea5aa44c15faeacf5e9e215e7875dfe57_84ba68ca-9632-4c46-8cc2-a4c44b8380d7.webp?v=1752650495","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c4e05e80a1b021b462654d01418aeccdfbfd3ee2_03ba303e-b972-42fe-b1ba-b0c94b12a04e.webp?v=1752650496","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e84967d99c8adebc42240ac9b1857af7814a90f_93f67a2d-6506-4a38-984a-4e6f85503273.webp?v=1752650497","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f85ea008cac024a83eb9fb02e8e8cfe237df2f37_1bff7f98-58d3-4029-bbdc-18adffd957a7.webp?v=1752650498","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffa50f7ffb76dc454e910d49e9a9d2122b032597_30b2260c-bed9-41b7-8b22-c74add319a64.webp?v=1752650499","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d676fb3102a1fe12fd9021ed7866202656bcdce_8253f7f4-7594-4ebc-8fa2-aace732aa09f.webp?v=1752650500","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2809718a5a15b8a8dd31b6a0aaa79d5bc0ec2ae_09803995-1ac1-48a9-aca1-81ce6f6e58c9.webp?v=1752650500"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/679fb6b22bc507a1ab6bf8ce2c10622906c81234_ac3b616c-0265-4e75-aad9-a1b1871e05fe.webp?v=1744730664","options":["color"],"media":[{"alt":null,"id":25496710938723,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/679fb6b22bc507a1ab6bf8ce2c10622906c81234_ac3b616c-0265-4e75-aad9-a1b1871e05fe.webp?v=1744730664"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/679fb6b22bc507a1ab6bf8ce2c10622906c81234_ac3b616c-0265-4e75-aad9-a1b1871e05fe.webp?v=1744730664","width":2000},{"alt":null,"id":25830064062563,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493","width":2000},{"alt":null,"id":25830064324707,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d55a28b5c622da9c942eb5d7fa35776fe95424a3_9c9cfaa0-73f5-4466-acf6-ab6c4cfee757.webp?v=1752650494"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d55a28b5c622da9c942eb5d7fa35776fe95424a3_9c9cfaa0-73f5-4466-acf6-ab6c4cfee757.webp?v=1752650494","width":2000},{"alt":null,"id":25830064750691,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b1eb3c8a87d99b2bca8b680b60d0e52aea8b6b9a_10df5288-16a6-430a-9c24-10e7dee75cc4.webp?v=1752650495"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b1eb3c8a87d99b2bca8b680b60d0e52aea8b6b9a_10df5288-16a6-430a-9c24-10e7dee75cc4.webp?v=1752650495","width":2000},{"alt":null,"id":25830065569891,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813feacea5aa44c15faeacf5e9e215e7875dfe57_84ba68ca-9632-4c46-8cc2-a4c44b8380d7.webp?v=1752650495"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/813feacea5aa44c15faeacf5e9e215e7875dfe57_84ba68ca-9632-4c46-8cc2-a4c44b8380d7.webp?v=1752650495","width":2000},{"alt":null,"id":25830066192483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496","width":2000},{"alt":null,"id":25830066716771,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c4e05e80a1b021b462654d01418aeccdfbfd3ee2_03ba303e-b972-42fe-b1ba-b0c94b12a04e.webp?v=1752650496"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c4e05e80a1b021b462654d01418aeccdfbfd3ee2_03ba303e-b972-42fe-b1ba-b0c94b12a04e.webp?v=1752650496","width":2000},{"alt":null,"id":25830067208291,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497","width":2000},{"alt":null,"id":25830067765347,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e84967d99c8adebc42240ac9b1857af7814a90f_93f67a2d-6506-4a38-984a-4e6f85503273.webp?v=1752650497"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e84967d99c8adebc42240ac9b1857af7814a90f_93f67a2d-6506-4a38-984a-4e6f85503273.webp?v=1752650497","width":2000},{"alt":null,"id":25830068355171,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f85ea008cac024a83eb9fb02e8e8cfe237df2f37_1bff7f98-58d3-4029-bbdc-18adffd957a7.webp?v=1752650498"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f85ea008cac024a83eb9fb02e8e8cfe237df2f37_1bff7f98-58d3-4029-bbdc-18adffd957a7.webp?v=1752650498","width":2000},{"alt":null,"id":25830068879459,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffa50f7ffb76dc454e910d49e9a9d2122b032597_30b2260c-bed9-41b7-8b22-c74add319a64.webp?v=1752650499"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffa50f7ffb76dc454e910d49e9a9d2122b032597_30b2260c-bed9-41b7-8b22-c74add319a64.webp?v=1752650499","width":2000},{"alt":null,"id":25830069338211,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d676fb3102a1fe12fd9021ed7866202656bcdce_8253f7f4-7594-4ebc-8fa2-aace732aa09f.webp?v=1752650500"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d676fb3102a1fe12fd9021ed7866202656bcdce_8253f7f4-7594-4ebc-8fa2-aace732aa09f.webp?v=1752650500","width":2000},{"alt":null,"id":25830070222947,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2809718a5a15b8a8dd31b6a0aaa79d5bc0ec2ae_09803995-1ac1-48a9-aca1-81ce6f6e58c9.webp?v=1752650500"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2809718a5a15b8a8dd31b6a0aaa79d5bc0ec2ae_09803995-1ac1-48a9-aca1-81ce6f6e58c9.webp?v=1752650500","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43305093333091,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721645155,"product_id":7770020577379,"position":8,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497","variant_ids":[43305093333091]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF57","featured_media":{"alt":null,"id":25830067208291,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305099853923,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197715091555,"product_id":7770020577379,"position":2,"created_at":"2025-07-16T15:21:31+08:00","updated_at":"2025-07-16T15:21:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493","variant_ids":[43305099853923]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF57","featured_media":{"alt":null,"id":25830064062563,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a923192c3de6d6206e2693d7de3188791d19cf2a_62962dce-3500-48d7-abc2-2a3c3793e852.webp?v=1752650493"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305100017763,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197719875683,"product_id":7770020577379,"position":6,"created_at":"2025-07-16T15:21:34+08:00","updated_at":"2025-07-16T15:21:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496","variant_ids":[43305100017763]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - 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":"MPB01262J5-XF57","featured_media":{"alt":null,"id":25830066192483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e483b7dab41fee4937ae883c13c5ecfe2752ef6f_20728c8b-6542-4c15-8edb-085487cddb72.webp?v=1752650496"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43305093333091,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF57","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721645155,"product_id":7770020577379,"position":8,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497","variant_ids":[43305093333091]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Stay Curious - 保持好奇心 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF57","featured_media":{"alt":null,"id":25830067208291,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae8ad8d6a2d72856805b5d2f6667cd05fe1c260e_0fdeabd4-cbaa-4047-b243-ae4d50e05b68.webp?v=1752650497"}},"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: "停產" }