$product = {"id":7809116209251,"title":"iPhone 16 Pro Max Clear (MagSafe 兼容) StarWars 星際大戰 星際大戰 – 達斯·維達","handle":"iphone-16-pro-max-jellytint-magsafe-pb147","description":null,"published_at":"2025-06-06T19:29:23+08:00","created_at":"2025-06-03T15:22:23+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師JellyTint MagSafe專區-迪士尼-星際大戰 Star Wars","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-star-wars","device-iPhone 16 Pro Max","merge","reseller-star-wars"],"price":148000,"price_min":148000,"price_max":148000,"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":43419730772067,"title":"Fancy Pink","option1":"Fancy Pink","option2":null,"option3":null,"sku":"MCN013280J-PB147","requires_shipping":true,"taxable":true,"featured_image":{"id":35082922983523,"product_id":7809116209251,"position":19,"created_at":"2026-01-09T10:16:21+08:00","updated_at":"2026-01-09T10:16:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983","variant_ids":[43419730772067]},"available":true,"name":"iPhone 16 Pro Max Clear (MagSafe 兼容) StarWars 星際大戰 星際大戰 – 達斯·維達 - Fancy Pink","public_title":"Fancy Pink","options":["Fancy Pink"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN013280J-PB147","featured_media":{"alt":null,"id":26639861842019,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/163f03791f69ad5496c305ed19510aac2adb66b0.webp?v=1748935348","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850.webp?v=1767858221","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a.webp?v=1767858221","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c.webp?v=1767858222","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289.webp?v=1767858222","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_4f1eee8a-1753-4a86-bc72-c182d901705a.webp?v=1767860502","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_54a9a00f-0ab2-4b34-9cb6-3047bdddfd1f.webp?v=1767860502","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_5dabed51-6617-4eae-8f9e-57c31f426af1.webp?v=1767860503","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_1d5240f6-51ee-48f2-b34f-b131127e9cc8.webp?v=1767860503","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_44556367-2704-4a49-9e5e-96bccb15648a.webp?v=1767861091","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_47e3919d-a314-444d-b7e6-f3b68e9d7557.webp?v=1767861091","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_05100c9d-bacb-46e9-b662-883e24b6dcab.webp?v=1767861092","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_9db167aa-f407-4553-82a8-72532edeea13.webp?v=1767861093","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_aa3b6ddf-e28c-4b7a-aae4-aca5bab3dac7.webp?v=1767861388","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_57283651-1729-457f-86c4-2577513684fb.webp?v=1767861388","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_396a47a2-f20f-4236-9576-3c5cbca78a69.webp?v=1767861389","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_9628f31e-54d9-4fe8-832c-5cd0ac667b66.webp?v=1767861390","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_c0c6db10-4560-4660-b5f0-5ff2b68008d9.webp?v=1767924983","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_28187697-5cf0-412f-8764-f7eda81f3a3e.webp?v=1767924983","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_b4e7c127-b72a-44cb-b651-88d471656478.webp?v=1767924984"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/163f03791f69ad5496c305ed19510aac2adb66b0.webp?v=1748935348","options":["color"],"media":[{"alt":null,"id":25661682778211,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/163f03791f69ad5496c305ed19510aac2adb66b0.webp?v=1748935348"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/163f03791f69ad5496c305ed19510aac2adb66b0.webp?v=1748935348","width":2000},{"alt":null,"id":26636211191907,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850.webp?v=1767858221"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850.webp?v=1767858221","width":2000},{"alt":null,"id":26636211617891,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a.webp?v=1767858221"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a.webp?v=1767858221","width":2000},{"alt":null,"id":26636211945571,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c.webp?v=1767858222"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c.webp?v=1767858222","width":2000},{"alt":null,"id":26636212273251,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289.webp?v=1767858222"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289.webp?v=1767858222","width":2000},{"alt":null,"id":26636278300771,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_4f1eee8a-1753-4a86-bc72-c182d901705a.webp?v=1767860502"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_4f1eee8a-1753-4a86-bc72-c182d901705a.webp?v=1767860502","width":2000},{"alt":null,"id":26636278661219,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_54a9a00f-0ab2-4b34-9cb6-3047bdddfd1f.webp?v=1767860502"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_54a9a00f-0ab2-4b34-9cb6-3047bdddfd1f.webp?v=1767860502","width":2000},{"alt":null,"id":26636278956131,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_5dabed51-6617-4eae-8f9e-57c31f426af1.webp?v=1767860503"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_5dabed51-6617-4eae-8f9e-57c31f426af1.webp?v=1767860503","width":2000},{"alt":null,"id":26636279185507,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_1d5240f6-51ee-48f2-b34f-b131127e9cc8.webp?v=1767860503"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_1d5240f6-51ee-48f2-b34f-b131127e9cc8.webp?v=1767860503","width":2000},{"alt":null,"id":26636321390691,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_44556367-2704-4a49-9e5e-96bccb15648a.webp?v=1767861091"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_44556367-2704-4a49-9e5e-96bccb15648a.webp?v=1767861091","width":2000},{"alt":null,"id":26636321718371,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_47e3919d-a314-444d-b7e6-f3b68e9d7557.webp?v=1767861091"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_47e3919d-a314-444d-b7e6-f3b68e9d7557.webp?v=1767861091","width":2000},{"alt":null,"id":26636321980515,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_05100c9d-bacb-46e9-b662-883e24b6dcab.webp?v=1767861092"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_05100c9d-bacb-46e9-b662-883e24b6dcab.webp?v=1767861092","width":2000},{"alt":null,"id":26636322275427,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_9db167aa-f407-4553-82a8-72532edeea13.webp?v=1767861093"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_9db167aa-f407-4553-82a8-72532edeea13.webp?v=1767861093","width":2000},{"alt":null,"id":26636361433187,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_aa3b6ddf-e28c-4b7a-aae4-aca5bab3dac7.webp?v=1767861388"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_aa3b6ddf-e28c-4b7a-aae4-aca5bab3dac7.webp?v=1767861388","width":2000},{"alt":null,"id":26636361760867,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_57283651-1729-457f-86c4-2577513684fb.webp?v=1767861388"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_57283651-1729-457f-86c4-2577513684fb.webp?v=1767861388","width":2000},{"alt":null,"id":26636362121315,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_396a47a2-f20f-4236-9576-3c5cbca78a69.webp?v=1767861389"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_396a47a2-f20f-4236-9576-3c5cbca78a69.webp?v=1767861389","width":2000},{"alt":null,"id":26636362416227,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_9628f31e-54d9-4fe8-832c-5cd0ac667b66.webp?v=1767861390"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_9628f31e-54d9-4fe8-832c-5cd0ac667b66.webp?v=1767861390","width":2000},{"alt":null,"id":26639861547107,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_c0c6db10-4560-4660-b5f0-5ff2b68008d9.webp?v=1767924983"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe145603c5bb4252def7f282fca1131514349c4a_c0c6db10-4560-4660-b5f0-5ff2b68008d9.webp?v=1767924983","width":2000},{"alt":null,"id":26639861842019,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983","width":2000},{"alt":null,"id":26639862169699,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_28187697-5cf0-412f-8764-f7eda81f3a3e.webp?v=1767924983"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0868efe62a3a8f3dd39894895ff26b9adedee9c_28187697-5cf0-412f-8764-f7eda81f3a3e.webp?v=1767924983","width":2000},{"alt":null,"id":26639862628451,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_b4e7c127-b72a-44cb-b651-88d471656478.webp?v=1767924984"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2d8c8aba1609c9b949e2a70eb1fd5f4984ff289_b4e7c127-b72a-44cb-b651-88d471656478.webp?v=1767924984","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43419730772067,"title":"Fancy Pink","option1":"Fancy Pink","option2":null,"option3":null,"sku":"MCN013280J-PB147","requires_shipping":true,"taxable":true,"featured_image":{"id":35082922983523,"product_id":7809116209251,"position":19,"created_at":"2026-01-09T10:16:21+08:00","updated_at":"2026-01-09T10:16:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983","variant_ids":[43419730772067]},"available":true,"name":"iPhone 16 Pro Max Clear (MagSafe 兼容) StarWars 星際大戰 星際大戰 – 達斯·維達 - Fancy Pink","public_title":"Fancy Pink","options":["Fancy Pink"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN013280J-PB147","featured_media":{"alt":null,"id":26639861842019,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43419730772067,"title":"Fancy Pink","option1":"Fancy Pink","option2":null,"option3":null,"sku":"MCN013280J-PB147","requires_shipping":true,"taxable":true,"featured_image":{"id":35082922983523,"product_id":7809116209251,"position":19,"created_at":"2026-01-09T10:16:21+08:00","updated_at":"2026-01-09T10:16:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983","variant_ids":[43419730772067]},"available":true,"name":"iPhone 16 Pro Max Clear (MagSafe 兼容) StarWars 星際大戰 星際大戰 – 達斯·維達 - Fancy Pink","public_title":"Fancy Pink","options":["Fancy Pink"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN013280J-PB147","featured_media":{"alt":null,"id":26639861842019,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23566db63b0a26155be6eb5a50224eb44adf6850_f3a0bc32-6eec-4260-97f5-f809af7ef833.webp?v=1767924983"}},"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: "停產" }