$product = {"id":7022979055715,"title":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋","handle":"iphone-13-mini-solidsuit-classic-magsafe-px06","description":"","published_at":"2023-10-04T10:10:33+08:00","created_at":"2023-09-28T19:18:14+08:00","vendor":"RHINOSHIELD","type":"設計師SolidSuit MagSafe專區-布丁狗&大耳狗","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-pompompurin-cinnamoroll","device-iPhone 13 Mini","merge","reseller-pompompurin-cinnamoroll"],"price":125000,"price_min":125000,"price_max":125000,"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":43103593726051,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PX06","requires_shipping":true,"taxable":true,"featured_image":{"id":30434624897123,"product_id":7022979055715,"position":1,"created_at":"2023-09-28T19:18:14+08:00","updated_at":"2023-09-28T19:18:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","variant_ids":[43103593726051,43103593889891]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋 - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PX06","featured_media":{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43103593889891,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PX06","requires_shipping":true,"taxable":true,"featured_image":{"id":30434624897123,"product_id":7022979055715,"position":1,"created_at":"2023-09-28T19:18:14+08:00","updated_at":"2023-09-28T19:18:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","variant_ids":[43103593726051,43103593889891]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋 - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PX06","featured_media":{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff.webp?v=1782199754","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3.webp?v=1782199755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37.webp?v=1782199755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b.webp?v=1782199756","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_1c59b4ae-d2cb-4dd4-8f5f-0f9e444e0b4f.webp?v=1782202110","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_1b662466-3421-4b22-91d1-a47256b1e1db.webp?v=1782202111","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_815c3697-2f02-43bf-809e-b14051baa537.webp?v=1782202112","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_7ab8d421-2d38-4f40-a060-a179786f0fb1.webp?v=1782202113","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_968fe329-6282-4049-9d41-3ee71838802d.webp?v=1782202185","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_38f55763-ea77-4897-aec5-2b6d2aeaa2ef.webp?v=1782202185","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_af764b4c-b97c-4c77-89e9-5cde3f4807bc.webp?v=1782202186","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_36c96f30-797e-4fe7-81bf-e35c6c86cb3a.webp?v=1782202187","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_6e93bcee-be61-4b26-9a94-199a3d155707.webp?v=1782202238","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_3060fa6d-1253-45bd-9607-e3474f19b547.webp?v=1782202239","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_a6b7a32e-9944-4ace-8375-a5bbd4851e04.webp?v=1782202239","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_3af820ad-32bb-4d30-8f70-2be2df287810.webp?v=1782202240"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","options":["color","Types"],"media":[{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","width":2000},{"alt":null,"id":27572555317347,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff.webp?v=1782199754"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff.webp?v=1782199754","width":2000},{"alt":null,"id":27572555776099,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3.webp?v=1782199755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3.webp?v=1782199755","width":2000},{"alt":null,"id":27572556071011,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37.webp?v=1782199755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37.webp?v=1782199755","width":2000},{"alt":null,"id":27572556529763,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b.webp?v=1782199756"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b.webp?v=1782199756","width":2000},{"alt":null,"id":27573877932131,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_1c59b4ae-d2cb-4dd4-8f5f-0f9e444e0b4f.webp?v=1782202110"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_1c59b4ae-d2cb-4dd4-8f5f-0f9e444e0b4f.webp?v=1782202110","width":2000},{"alt":null,"id":27573878653027,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_1b662466-3421-4b22-91d1-a47256b1e1db.webp?v=1782202111"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_1b662466-3421-4b22-91d1-a47256b1e1db.webp?v=1782202111","width":2000},{"alt":null,"id":27573878816867,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_815c3697-2f02-43bf-809e-b14051baa537.webp?v=1782202112"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_815c3697-2f02-43bf-809e-b14051baa537.webp?v=1782202112","width":2000},{"alt":null,"id":27573879537763,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_7ab8d421-2d38-4f40-a060-a179786f0fb1.webp?v=1782202113"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_7ab8d421-2d38-4f40-a060-a179786f0fb1.webp?v=1782202113","width":2000},{"alt":null,"id":27573915484259,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_968fe329-6282-4049-9d41-3ee71838802d.webp?v=1782202185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_968fe329-6282-4049-9d41-3ee71838802d.webp?v=1782202185","width":2000},{"alt":null,"id":27573915680867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_38f55763-ea77-4897-aec5-2b6d2aeaa2ef.webp?v=1782202185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_38f55763-ea77-4897-aec5-2b6d2aeaa2ef.webp?v=1782202185","width":2000},{"alt":null,"id":27573916139619,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_af764b4c-b97c-4c77-89e9-5cde3f4807bc.webp?v=1782202186"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_af764b4c-b97c-4c77-89e9-5cde3f4807bc.webp?v=1782202186","width":2000},{"alt":null,"id":27573916598371,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_36c96f30-797e-4fe7-81bf-e35c6c86cb3a.webp?v=1782202187"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_36c96f30-797e-4fe7-81bf-e35c6c86cb3a.webp?v=1782202187","width":2000},{"alt":null,"id":27573940289635,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_6e93bcee-be61-4b26-9a94-199a3d155707.webp?v=1782202238"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab4c1e5d4c0ea88c466a310517b69c8abf43aaff_6e93bcee-be61-4b26-9a94-199a3d155707.webp?v=1782202238","width":2000},{"alt":null,"id":27573940715619,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_3060fa6d-1253-45bd-9607-e3474f19b547.webp?v=1782202239"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84cb4d248c51b048a9f0c52ae601bc41cd29f8c3_3060fa6d-1253-45bd-9607-e3474f19b547.webp?v=1782202239","width":2000},{"alt":null,"id":27573940879459,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_a6b7a32e-9944-4ace-8375-a5bbd4851e04.webp?v=1782202239"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f2daf8c7ac1a05ef8ae9a4849998919f435e2d37_a6b7a32e-9944-4ace-8375-a5bbd4851e04.webp?v=1782202239","width":2000},{"alt":null,"id":27573941272675,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_3af820ad-32bb-4d30-8f70-2be2df287810.webp?v=1782202240"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bac07119be3fe8eb0fb31904b9b6c9403c0956b_3af820ad-32bb-4d30-8f70-2be2df287810.webp?v=1782202240","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":""}; $isMerge = null; $variants = [{"id":43103593726051,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PX06","requires_shipping":true,"taxable":true,"featured_image":{"id":30434624897123,"product_id":7022979055715,"position":1,"created_at":"2023-09-28T19:18:14+08:00","updated_at":"2023-09-28T19:18:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","variant_ids":[43103593726051,43103593889891]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋 - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PX06","featured_media":{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43103593889891,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PX06","requires_shipping":true,"taxable":true,"featured_image":{"id":30434624897123,"product_id":7022979055715,"position":1,"created_at":"2023-09-28T19:18:14+08:00","updated_at":"2023-09-28T19:18:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","variant_ids":[43103593726051,43103593889891]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋 - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PX06","featured_media":{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43103593726051,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PX06","requires_shipping":true,"taxable":true,"featured_image":{"id":30434624897123,"product_id":7022979055715,"position":1,"created_at":"2023-09-28T19:18:14+08:00","updated_at":"2023-09-28T19:18:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894","variant_ids":[43103593726051,43103593889891]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) 布丁狗與大耳狗 派對系列-派對格紋 - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PX06","featured_media":{"alt":null,"id":22794958864483,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/SolidSuitTPE-53-228-PX06_6f82bf23-c40d-460a-ac43-8f05aa1ea301.png?v=1695899894"}},"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: "停產" }