$product = {"id":6984201306211,"title":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W","handle":"iphone-13-mini-solidsuit-classic-magsafe-pm47","description":null,"published_at":"2023-08-02T22:38:50+08:00","created_at":"2023-07-28T13:35:45+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師SolidSuit MagSafe專區-哈利波特 Harry Potter","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 13 Mini","merge","reseller-nba"],"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":43103526846563,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM47","requires_shipping":true,"taxable":true,"featured_image":{"id":30278877446243,"product_id":6984201306211,"position":1,"created_at":"2023-07-28T13:35:48+08:00","updated_at":"2023-07-28T13:35:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","variant_ids":[43103526846563,43103527010403]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM47","featured_media":{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43103527010403,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM47","requires_shipping":true,"taxable":true,"featured_image":{"id":30278877446243,"product_id":6984201306211,"position":1,"created_at":"2023-07-28T13:35:48+08:00","updated_at":"2023-07-28T13:35:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","variant_ids":[43103526846563,43103527010403]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM47","featured_media":{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7.webp?v=1782205159","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a.webp?v=1782205160","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6.webp?v=1782205160","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4.webp?v=1782205161","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_57d3ca69-24ab-4ffc-b4d2-13b85b6903ef.webp?v=1782218440","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_726dc367-b07d-49cf-8dab-bcf71570c70f.webp?v=1782218441","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_046c056b-b5b6-49bf-9461-5a1a573c4657.webp?v=1782218441","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_bebb8ad8-543a-452f-beb7-622e8e61af5a.webp?v=1782218442","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_53a27d5f-2a46-4d30-b627-a58d35065bd0.webp?v=1782218762","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_d31dfa0d-cae0-4279-89fd-c3a9dad7100f.webp?v=1782218763","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_18ec5374-eb7f-4738-be75-6896767ac7e4.webp?v=1782218763","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_87fcecf8-2012-424d-82d8-ad244f6e8c45.webp?v=1782218764","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_99a77323-5849-42cf-91de-29b95a6d7064.webp?v=1782219051","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_ca0d8bfc-bb1e-4a44-afb4-518160c9be3b.webp?v=1782219052","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_eb4d8009-c1d7-47d4-ba88-5c2399ca0139.webp?v=1782219052","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_2d1bbc14-ec94-458c-adf4-ce62b96ee638.webp?v=1782219053"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","options":["color","Types"],"media":[{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","width":2000},{"alt":null,"id":27575147659363,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7.webp?v=1782205159"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7.webp?v=1782205159","width":2000},{"alt":null,"id":27575147921507,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a.webp?v=1782205160"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a.webp?v=1782205160","width":2000},{"alt":null,"id":27575148118115,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6.webp?v=1782205160"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6.webp?v=1782205160","width":2000},{"alt":null,"id":27575148314723,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4.webp?v=1782205161"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4.webp?v=1782205161","width":2000},{"alt":null,"id":27581463855203,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_57d3ca69-24ab-4ffc-b4d2-13b85b6903ef.webp?v=1782218440"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_57d3ca69-24ab-4ffc-b4d2-13b85b6903ef.webp?v=1782218440","width":2000},{"alt":null,"id":27581464412259,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_726dc367-b07d-49cf-8dab-bcf71570c70f.webp?v=1782218441"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_726dc367-b07d-49cf-8dab-bcf71570c70f.webp?v=1782218441","width":2000},{"alt":null,"id":27581464805475,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_046c056b-b5b6-49bf-9461-5a1a573c4657.webp?v=1782218441"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_046c056b-b5b6-49bf-9461-5a1a573c4657.webp?v=1782218441","width":2000},{"alt":null,"id":27581465100387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_bebb8ad8-543a-452f-beb7-622e8e61af5a.webp?v=1782218442"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_bebb8ad8-543a-452f-beb7-622e8e61af5a.webp?v=1782218442","width":2000},{"alt":null,"id":27581642375267,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_53a27d5f-2a46-4d30-b627-a58d35065bd0.webp?v=1782218762"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_53a27d5f-2a46-4d30-b627-a58d35065bd0.webp?v=1782218762","width":2000},{"alt":null,"id":27581642735715,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_d31dfa0d-cae0-4279-89fd-c3a9dad7100f.webp?v=1782218763"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_d31dfa0d-cae0-4279-89fd-c3a9dad7100f.webp?v=1782218763","width":2000},{"alt":null,"id":27581643063395,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_18ec5374-eb7f-4738-be75-6896767ac7e4.webp?v=1782218763"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_18ec5374-eb7f-4738-be75-6896767ac7e4.webp?v=1782218763","width":2000},{"alt":null,"id":27581643227235,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_87fcecf8-2012-424d-82d8-ad244f6e8c45.webp?v=1782218764"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_87fcecf8-2012-424d-82d8-ad244f6e8c45.webp?v=1782218764","width":2000},{"alt":null,"id":27581786554467,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_99a77323-5849-42cf-91de-29b95a6d7064.webp?v=1782219051"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9e748226f00ac3214c74d6f9afc4254282c56fd7_99a77323-5849-42cf-91de-29b95a6d7064.webp?v=1782219051","width":2000},{"alt":null,"id":27581786816611,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_ca0d8bfc-bb1e-4a44-afb4-518160c9be3b.webp?v=1782219052"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ca7891019ccfec6c5307a5980327a20cdbb62d9a_ca0d8bfc-bb1e-4a44-afb4-518160c9be3b.webp?v=1782219052","width":2000},{"alt":null,"id":27581787078755,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_eb4d8009-c1d7-47d4-ba88-5c2399ca0139.webp?v=1782219052"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb15d2affb68319503f5eb6c0945a38cada7e9b6_eb4d8009-c1d7-47d4-ba88-5c2399ca0139.webp?v=1782219052","width":2000},{"alt":null,"id":27581787275363,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_2d1bbc14-ec94-458c-adf4-ce62b96ee638.webp?v=1782219053"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d6ae3c43fb1963e10a97fe957c70dfb534e35c4_2d1bbc14-ec94-458c-adf4-ce62b96ee638.webp?v=1782219053","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43103526846563,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM47","requires_shipping":true,"taxable":true,"featured_image":{"id":30278877446243,"product_id":6984201306211,"position":1,"created_at":"2023-07-28T13:35:48+08:00","updated_at":"2023-07-28T13:35:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","variant_ids":[43103526846563,43103527010403]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM47","featured_media":{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43103527010403,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM47","requires_shipping":true,"taxable":true,"featured_image":{"id":30278877446243,"product_id":6984201306211,"position":1,"created_at":"2023-07-28T13:35:48+08:00","updated_at":"2023-07-28T13:35:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","variant_ids":[43103526846563,43103527010403]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM47","featured_media":{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43103526846563,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM47","requires_shipping":true,"taxable":true,"featured_image":{"id":30278877446243,"product_id":6984201306211,"position":1,"created_at":"2023-07-28T13:35:48+08:00","updated_at":"2023-07-28T13:35:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548","variant_ids":[43103526846563,43103527010403]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA B\u0026W-丹佛金塊 Denver Nuggets B\u0026W - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM47","featured_media":{"alt":null,"id":22637511114851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM47_a7c67fd0-da16-4d19-a5c3-4389f024d8da.png?v=1690522548"}},"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: "停產" }