$product = {"id":7159284203619,"title":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks","handle":"iphone-14-jellytint-pm14","description":null,"published_at":"2024-02-01T15:09:30+08:00","created_at":"2024-01-26T17:53:43+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 14","merge","reseller-nba"],"price":128000,"price_min":128000,"price_max":128000,"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":41214115217507,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012600G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328355939,"product_id":7159284203619,"position":11,"created_at":"2026-07-02T12:15:47+08:00","updated_at":"2026-07-02T12:15:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749","variant_ids":[41214115217507]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600G-PM14","featured_media":{"alt":null,"id":27657201844323,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41214115283043,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"CCN012600I-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328585315,"product_id":7159284203619,"position":12,"created_at":"2026-07-02T12:15:48+08:00","updated_at":"2026-07-02T12:15:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750","variant_ids":[41214115283043]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600I-PM14","featured_media":{"alt":null,"id":27657202073699,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41214115315811,"title":"Fancy Pink","option1":"Fancy Pink","option2":null,"option3":null,"sku":"CCN012600J-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328683619,"product_id":7159284203619,"position":13,"created_at":"2026-07-02T12:15:48+08:00","updated_at":"2026-07-02T12:15:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751","variant_ids":[41214115315811]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Fancy Pink","public_title":"Fancy Pink","options":["Fancy Pink"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600J-PM14","featured_media":{"alt":null,"id":27657202172003,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-260-PM14_3b8027ca-5187-422e-a6d3-a0134db4e4fc.png?v=1706262825","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_81988939-fba6-403f-b191-0e3a85d5ed29.webp?v=1782206571","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_2b018d46-f8bb-4239-8664-1d47c8c3294d.webp?v=1782206572","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_d68105c0-0372-44f0-b46f-5e5d9f00ef20.webp?v=1782206572","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_9adf2f63-fed1-4c02-88d0-c5cf46945b96.webp?v=1782957714","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_00362401-5d96-4989-9462-5c9dff3a9b67.webp?v=1782957716","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_c29c1182-de13-4f4f-a23b-cbbf322d65cf.webp?v=1782957718","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_5a1f483a-ae06-4b50-b9dc-f8f40bc76cfd.webp?v=1782961357","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_9eec677b-2868-42ee-9c4e-d65d74f55aa7.webp?v=1782961358","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_19881434-1d70-4d57-805e-beb4b598a1aa.webp?v=1782961359","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-260-PM14_3b8027ca-5187-422e-a6d3-a0134db4e4fc.png?v=1706262825","options":["color"],"media":[{"alt":null,"id":23219517522019,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-260-PM14_3b8027ca-5187-422e-a6d3-a0134db4e4fc.png?v=1706262825"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-260-PM14_3b8027ca-5187-422e-a6d3-a0134db4e4fc.png?v=1706262825","width":2000},{"alt":null,"id":27575630528611,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_81988939-fba6-403f-b191-0e3a85d5ed29.webp?v=1782206571"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_81988939-fba6-403f-b191-0e3a85d5ed29.webp?v=1782206571","width":2000},{"alt":null,"id":27575631052899,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_2b018d46-f8bb-4239-8664-1d47c8c3294d.webp?v=1782206572"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_2b018d46-f8bb-4239-8664-1d47c8c3294d.webp?v=1782206572","width":2000},{"alt":null,"id":27575631544419,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_d68105c0-0372-44f0-b46f-5e5d9f00ef20.webp?v=1782206572"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_d68105c0-0372-44f0-b46f-5e5d9f00ef20.webp?v=1782206572","width":2000},{"alt":null,"id":27655898202211,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_9adf2f63-fed1-4c02-88d0-c5cf46945b96.webp?v=1782957714"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_9adf2f63-fed1-4c02-88d0-c5cf46945b96.webp?v=1782957714","width":2000},{"alt":null,"id":27655898464355,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_00362401-5d96-4989-9462-5c9dff3a9b67.webp?v=1782957716"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_00362401-5d96-4989-9462-5c9dff3a9b67.webp?v=1782957716","width":2000},{"alt":null,"id":27655899054179,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_c29c1182-de13-4f4f-a23b-cbbf322d65cf.webp?v=1782957718"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_c29c1182-de13-4f4f-a23b-cbbf322d65cf.webp?v=1782957718","width":2000},{"alt":null,"id":27656733360227,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_5a1f483a-ae06-4b50-b9dc-f8f40bc76cfd.webp?v=1782961357"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_5a1f483a-ae06-4b50-b9dc-f8f40bc76cfd.webp?v=1782961357","width":2000},{"alt":null,"id":27656733622371,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_9eec677b-2868-42ee-9c4e-d65d74f55aa7.webp?v=1782961358"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_9eec677b-2868-42ee-9c4e-d65d74f55aa7.webp?v=1782961358","width":2000},{"alt":null,"id":27656733786211,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_19881434-1d70-4d57-805e-beb4b598a1aa.webp?v=1782961359"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_19881434-1d70-4d57-805e-beb4b598a1aa.webp?v=1782961359","width":2000},{"alt":null,"id":27657201844323,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749","width":2000},{"alt":null,"id":27657202073699,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750","width":2000},{"alt":null,"id":27657202172003,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":41214115217507,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012600G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328355939,"product_id":7159284203619,"position":11,"created_at":"2026-07-02T12:15:47+08:00","updated_at":"2026-07-02T12:15:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749","variant_ids":[41214115217507]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600G-PM14","featured_media":{"alt":null,"id":27657201844323,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41214115283043,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"CCN012600I-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328585315,"product_id":7159284203619,"position":12,"created_at":"2026-07-02T12:15:48+08:00","updated_at":"2026-07-02T12:15:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750","variant_ids":[41214115283043]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600I-PM14","featured_media":{"alt":null,"id":27657202073699,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1cfc0efebe2439434efeca81554bd990116997e_bacb735b-a556-42fc-9e18-f7a85df6f50d.webp?v=1782965750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41214115315811,"title":"Fancy Pink","option1":"Fancy Pink","option2":null,"option3":null,"sku":"CCN012600J-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328683619,"product_id":7159284203619,"position":13,"created_at":"2026-07-02T12:15:48+08:00","updated_at":"2026-07-02T12:15:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751","variant_ids":[41214115315811]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Fancy Pink","public_title":"Fancy Pink","options":["Fancy Pink"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600J-PM14","featured_media":{"alt":null,"id":27657202172003,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/579d26e22ba3fe0f26e8a3aeaa185a8b833cfb4b_177d10e4-25d4-4e23-9d0e-598754ab44f0.webp?v=1782965751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":41214115217507,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012600G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152328355939,"product_id":7159284203619,"position":11,"created_at":"2026-07-02T12:15:47+08:00","updated_at":"2026-07-02T12:15:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749","variant_ids":[41214115217507]},"available":true,"name":"iPhone 14 Clear NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1180,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012600G-PM14","featured_media":{"alt":null,"id":27657201844323,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a80818be373d3a73cda5fef5e6a81b0bf41c178_ec9f8ea9-6bff-46a2-8d23-8375c29795fd.webp?v=1782965749"}},"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: "停產" }