$product = {"id":7824537747555,"title":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米","handle":"iphone-15-plus-solidx-magsafe-ka58","description":null,"published_at":"2025-07-01T17:35:31+08:00","created_at":"2025-06-20T18:14:12+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-wasangshow","device-iPhone 15 Plus","merge","reseller-wasangshow"],"price":145000,"price_min":145000,"price_max":145000,"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":43480167350371,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MNS0129652-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480146243683,"product_id":7824537747555,"position":11,"created_at":"2026-08-04T18:39:57+08:00","updated_at":"2026-08-04T18:39:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999","variant_ids":[43480167350371]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Black","public_title":"Black","options":["Black"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS0129652-KA58","featured_media":{"alt":null,"id":27983465218147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171806819,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"MNS01296O8-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480143917155,"product_id":7824537747555,"position":8,"created_at":"2026-08-04T18:39:50+08:00","updated_at":"2026-08-04T18:39:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992","variant_ids":[43480171806819]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS01296O8-KA58","featured_media":{"alt":null,"id":27983462891619,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171937891,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"MNS012960A-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480145621091,"product_id":7824537747555,"position":10,"created_at":"2026-08-04T18:39:55+08:00","updated_at":"2026-08-04T18:40:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002","variant_ids":[43480171937891]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS012960A-KA58","featured_media":{"alt":null,"id":27983464595555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171970659,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"MNS01296Z7-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480144703587,"product_id":7824537747555,"position":9,"created_at":"2026-08-04T18:39:52+08:00","updated_at":"2026-08-04T18:39:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994","variant_ids":[43480171970659]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS01296Z7-KA58","featured_media":{"alt":null,"id":27983463678051,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_830c1bed-5bda-4e29-97a0-ca11a37a7a14.png?v=1750414455","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_ab50f347-bd86-4824-aaca-040f14ad0664.png?v=1750642597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-KA58_2c2cf93a-c8df-4079-a9f8-af9c3baa89a2.png?v=1750819953","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0.webp?v=1784026679","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e.webp?v=1784026680","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894.webp?v=1784026680","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0.webp?v=1784026681","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_830c1bed-5bda-4e29-97a0-ca11a37a7a14.png?v=1750414455","options":["color"],"media":[{"alt":null,"id":25722220347491,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_830c1bed-5bda-4e29-97a0-ca11a37a7a14.png?v=1750414455"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_830c1bed-5bda-4e29-97a0-ca11a37a7a14.png?v=1750414455","width":2000},{"alt":null,"id":25727974998115,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_ab50f347-bd86-4824-aaca-040f14ad0664.png?v=1750642597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-296-KA58_ab50f347-bd86-4824-aaca-040f14ad0664.png?v=1750642597","width":2000},{"alt":null,"id":25735032111203,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-KA58_2c2cf93a-c8df-4079-a9f8-af9c3baa89a2.png?v=1750819953"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-KA58_2c2cf93a-c8df-4079-a9f8-af9c3baa89a2.png?v=1750819953","width":2000},{"alt":null,"id":27764887289955,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0.webp?v=1784026679"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0.webp?v=1784026679","width":2000},{"alt":null,"id":27764887486563,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e.webp?v=1784026680"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e.webp?v=1784026680","width":2000},{"alt":null,"id":27764888043619,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894.webp?v=1784026680"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894.webp?v=1784026680","width":2000},{"alt":null,"id":27764888666211,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0.webp?v=1784026681"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0.webp?v=1784026681","width":2000},{"alt":null,"id":27983462891619,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992","width":2000},{"alt":null,"id":27983463678051,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994","width":2000},{"alt":null,"id":27983464595555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002","width":2000},{"alt":null,"id":27983465218147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43480167350371,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MNS0129652-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480146243683,"product_id":7824537747555,"position":11,"created_at":"2026-08-04T18:39:57+08:00","updated_at":"2026-08-04T18:39:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999","variant_ids":[43480167350371]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Black","public_title":"Black","options":["Black"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS0129652-KA58","featured_media":{"alt":null,"id":27983465218147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171806819,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"MNS01296O8-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480143917155,"product_id":7824537747555,"position":8,"created_at":"2026-08-04T18:39:50+08:00","updated_at":"2026-08-04T18:39:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992","variant_ids":[43480171806819]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS01296O8-KA58","featured_media":{"alt":null,"id":27983462891619,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/741a03031a1ceae09a94f41d49f31dae1f956894_5a3b1484-521d-4ee2-9608-8873ac277432.webp?v=1785839992"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171937891,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"MNS012960A-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480145621091,"product_id":7824537747555,"position":10,"created_at":"2026-08-04T18:39:55+08:00","updated_at":"2026-08-04T18:40:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002","variant_ids":[43480171937891]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS012960A-KA58","featured_media":{"alt":null,"id":27983464595555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a21da35a03ae683f19d7e3f5269295e0d2978cd0_9bea124a-07c9-4a0d-aea7-4b56d8db1360.webp?v=1785840002"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43480171970659,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"MNS01296Z7-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480144703587,"product_id":7824537747555,"position":9,"created_at":"2026-08-04T18:39:52+08:00","updated_at":"2026-08-04T18:39:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994","variant_ids":[43480171970659]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS01296Z7-KA58","featured_media":{"alt":null,"id":27983463678051,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0a9de4be81e433cb1b46e0d4fb80e8e699b81e0_dd937fbb-9ddb-4f98-abf7-6bb9960d6752.webp?v=1785839994"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43480167350371,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MNS0129652-KA58","requires_shipping":true,"taxable":true,"featured_image":{"id":36480146243683,"product_id":7824537747555,"position":11,"created_at":"2026-08-04T18:39:57+08:00","updated_at":"2026-08-04T18:39:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999","variant_ids":[43480167350371]},"available":true,"name":"iPhone 15 Plus SolidX (MagSafe 兼容) 花生騷WasangShow 海洋WAWA-鯨魚小米 - Black","public_title":"Black","options":["Black"],"price":145000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MNS0129652-KA58","featured_media":{"alt":null,"id":27983465218147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a581d013d07bf74219b2fbb70ab761585005743e_73be0401-fa26-4596-96c1-20e57c76b378.webp?v=1785839999"}},"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: "停產" }