$product = {"id":7863217750115,"title":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks","handle":"iphone-air-jellytint-magsafe-with-capture-button-pm14","description":null,"published_at":"2025-09-10T19:07:46+08:00","created_at":"2025-08-22T18:37:48+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone Air","merge","reseller-nba"],"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":43608348295267,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013510G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152575361123,"product_id":7863217750115,"position":11,"created_at":"2026-07-02T12:27:29+08:00","updated_at":"2026-07-02T12:27:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451","variant_ids":[43608348295267]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013510G-PM14","featured_media":{"alt":null,"id":27657448849507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43608349278307,"title":"Nocturne Blue","option1":"Nocturne Blue","option2":null,"option3":null,"sku":"MJB013514M-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152576016483,"product_id":7863217750115,"position":13,"created_at":"2026-07-02T12:27:31+08:00","updated_at":"2026-07-02T12:27:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452","variant_ids":[43608349278307]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Nocturne Blue","public_title":"Nocturne Blue","options":["Nocturne Blue"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013514M-PM14","featured_media":{"alt":null,"id":27657449537635,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43608349311075,"title":"Gleam Rosé","option1":"Gleam Rosé","option2":null,"option3":null,"sku":"MJB013514L-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152575492195,"product_id":7863217750115,"position":12,"created_at":"2026-07-02T12:27:30+08:00","updated_at":"2026-07-02T12:27:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451","variant_ids":[43608349311075]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Gleam Rosé","public_title":"Gleam Rosé","options":["Gleam Rosé"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013514L-PM14","featured_media":{"alt":null,"id":27657448980579,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-351-PM14_5a77921e-6c4a-411b-9733-f5e6d1d8fb75.png?v=1755859071","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d.webp?v=1782215314","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9.webp?v=1782215314","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3.webp?v=1782215315","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_ab69941e-1a7f-4768-b7b1-9ba783f17587.webp?v=1782958869","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_94d01d57-e4d0-4276-93a1-c9c66c7363ec.webp?v=1782958869","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_5447d6e6-514c-43c1-b7e7-c47371b477a4.webp?v=1782958870","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_40ca2bd7-276c-4962-b035-cb487501da1f.webp?v=1782962216","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e69ff9f3-20f5-4d70-a48f-f0b78c7fe5e0.webp?v=1782962218","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_f96c8365-6905-4e46-9d3d-930d712bd9fd.webp?v=1782962220","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-351-PM14_5a77921e-6c4a-411b-9733-f5e6d1d8fb75.png?v=1755859071","options":["color"],"media":[{"alt":null,"id":25941184446563,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-351-PM14_5a77921e-6c4a-411b-9733-f5e6d1d8fb75.png?v=1755859071"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-351-PM14_5a77921e-6c4a-411b-9733-f5e6d1d8fb75.png?v=1755859071","width":2000},{"alt":null,"id":27580167618659,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d.webp?v=1782215314"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d.webp?v=1782215314","width":2000},{"alt":null,"id":27580167716963,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9.webp?v=1782215314"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9.webp?v=1782215314","width":2000},{"alt":null,"id":27580167880803,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3.webp?v=1782215315"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3.webp?v=1782215315","width":2000},{"alt":null,"id":27656331624547,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_ab69941e-1a7f-4768-b7b1-9ba783f17587.webp?v=1782958869"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_ab69941e-1a7f-4768-b7b1-9ba783f17587.webp?v=1782958869","width":2000},{"alt":null,"id":27656332214371,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_94d01d57-e4d0-4276-93a1-c9c66c7363ec.webp?v=1782958869"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_94d01d57-e4d0-4276-93a1-c9c66c7363ec.webp?v=1782958869","width":2000},{"alt":null,"id":27656333033571,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_5447d6e6-514c-43c1-b7e7-c47371b477a4.webp?v=1782958870"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_5447d6e6-514c-43c1-b7e7-c47371b477a4.webp?v=1782958870","width":2000},{"alt":null,"id":27656947695715,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_40ca2bd7-276c-4962-b035-cb487501da1f.webp?v=1782962216"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_40ca2bd7-276c-4962-b035-cb487501da1f.webp?v=1782962216","width":2000},{"alt":null,"id":27656948154467,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e69ff9f3-20f5-4d70-a48f-f0b78c7fe5e0.webp?v=1782962218"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e69ff9f3-20f5-4d70-a48f-f0b78c7fe5e0.webp?v=1782962218","width":2000},{"alt":null,"id":27656948285539,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_f96c8365-6905-4e46-9d3d-930d712bd9fd.webp?v=1782962220"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_f96c8365-6905-4e46-9d3d-930d712bd9fd.webp?v=1782962220","width":2000},{"alt":null,"id":27657448849507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451","width":2000},{"alt":null,"id":27657448980579,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451","width":2000},{"alt":null,"id":27657449537635,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43608348295267,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013510G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152575361123,"product_id":7863217750115,"position":11,"created_at":"2026-07-02T12:27:29+08:00","updated_at":"2026-07-02T12:27:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451","variant_ids":[43608348295267]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013510G-PM14","featured_media":{"alt":null,"id":27657448849507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43608349278307,"title":"Nocturne Blue","option1":"Nocturne Blue","option2":null,"option3":null,"sku":"MJB013514M-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152576016483,"product_id":7863217750115,"position":13,"created_at":"2026-07-02T12:27:31+08:00","updated_at":"2026-07-02T12:27:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452","variant_ids":[43608349278307]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Nocturne Blue","public_title":"Nocturne Blue","options":["Nocturne Blue"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013514M-PM14","featured_media":{"alt":null,"id":27657449537635,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c51bdbc7c2bdbfde334fa8ec5ba817d1bc6681b3_3227a303-0cd9-4a87-b2a3-74d0a6a21910.webp?v=1782966452"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43608349311075,"title":"Gleam Rosé","option1":"Gleam Rosé","option2":null,"option3":null,"sku":"MJB013514L-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152575492195,"product_id":7863217750115,"position":12,"created_at":"2026-07-02T12:27:30+08:00","updated_at":"2026-07-02T12:27:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451","variant_ids":[43608349311075]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Gleam Rosé","public_title":"Gleam Rosé","options":["Gleam Rosé"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013514L-PM14","featured_media":{"alt":null,"id":27657448980579,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/142a003cd16a7cbc5cee6a2bccd3e9c300cc42d9_e7055511-2b44-4e51-b821-a5f343b01688.webp?v=1782966451"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43608348295267,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013510G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152575361123,"product_id":7863217750115,"position":11,"created_at":"2026-07-02T12:27:29+08:00","updated_at":"2026-07-02T12:27:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451","variant_ids":[43608348295267]},"available":true,"name":"iPhone Air Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013510G-PM14","featured_media":{"alt":null,"id":27657448849507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffef92c8363810657613ffd71ed3a54e2383868d_0116e09f-f6fa-4617-84a4-c36ed5684261.webp?v=1782966451"}},"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: "停產" }