$product = {"id":7980402802787,"title":"iPhone 17 Pro ClearX (抗刮抗指紋加強版) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks","handle":"iphone-17-pro-clearx-magsafe-pm14","description":null,"published_at":"2026-11-04T13:47:06+08:00","created_at":"2026-03-17T16:04:18+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 17 Pro","merge","reseller-nba"],"price":178000,"price_min":178000,"price_max":178000,"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":44061591142499,"title":"Clear Pure","option1":"Clear Pure","option2":null,"option3":null,"sku":"MCX013945Q-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152518705251,"product_id":7980402802787,"position":18,"created_at":"2026-07-02T12:24:35+08:00","updated_at":"2026-07-02T12:24:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277","variant_ids":[44061591142499]},"available":true,"name":"iPhone 17 Pro ClearX (抗刮抗指紋加強版) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Clear Pure","public_title":"Clear Pure","options":["Clear Pure"],"price":178000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCX013525Q-PM14","featured_media":{"alt":null,"id":27657392193635,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ClearX-5S-352-PM14_c2b6cb54-459e-4a8d-bd33-10604789bcfd.png?v=1773734661","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7.webp?v=1782213213","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb.webp?v=1782213214","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245.webp?v=1782213214","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32.webp?v=1782213215","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba.webp?v=1782213215","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_76f647bb-f8dc-4e5e-b437-19b12eddbd1b.webp?v=1782958609","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_315bd36e-a1f9-450d-933a-1169f4deb0a4.webp?v=1782958610","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_503f599d-e361-4ebd-84a1-c9db325067f2.webp?v=1782958611","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1423e266-4d7f-48bd-903e-c8983a7330be.webp?v=1782958611","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_c8aa9a9d-fda0-4786-8204-d106ffed412d.webp?v=1782958612","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_0de0f4ec-100e-4c8b-b544-5ea2fac618af.webp?v=1782961968","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_0c52e2b1-4a4e-492d-bebb-e2978b425473.webp?v=1782961970","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_ce8312cf-7b9e-4403-a2bd-76d70d323b04.webp?v=1782961973","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_8547af20-3b85-4ebe-9f89-a278748a807d.webp?v=1782961976","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_96bdd205-bc97-4da2-9ff1-00f1ea654f13.webp?v=1782961977","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_192a746a-8be4-4706-9343-8edb40a6c981.webp?v=1782966277","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_c59d2f3b-46e4-43cb-af21-1b13f012ce83.webp?v=1782966278","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1c20493c-3a31-4317-ba45-2a74f36ebf47.webp?v=1782966278","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_59e592a5-4bcf-4efb-9234-4994bcf71b14.webp?v=1782966279"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ClearX-5S-352-PM14_c2b6cb54-459e-4a8d-bd33-10604789bcfd.png?v=1773734661","options":["color"],"media":[{"alt":null,"id":27022812217443,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ClearX-5S-352-PM14_c2b6cb54-459e-4a8d-bd33-10604789bcfd.png?v=1773734661"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ClearX-5S-352-PM14_c2b6cb54-459e-4a8d-bd33-10604789bcfd.png?v=1773734661","width":2000},{"alt":null,"id":27578399817827,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7.webp?v=1782213213"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7.webp?v=1782213213","width":2000},{"alt":null,"id":27578400276579,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb.webp?v=1782213214"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb.webp?v=1782213214","width":2000},{"alt":null,"id":27578400899171,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245.webp?v=1782213214"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245.webp?v=1782213214","width":2000},{"alt":null,"id":27578401226851,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32.webp?v=1782213215"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32.webp?v=1782213215","width":2000},{"alt":null,"id":27578401849443,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba.webp?v=1782213215"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba.webp?v=1782213215","width":2000},{"alt":null,"id":27656228962403,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_76f647bb-f8dc-4e5e-b437-19b12eddbd1b.webp?v=1782958609"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_76f647bb-f8dc-4e5e-b437-19b12eddbd1b.webp?v=1782958609","width":2000},{"alt":null,"id":27656229748835,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_315bd36e-a1f9-450d-933a-1169f4deb0a4.webp?v=1782958610"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_315bd36e-a1f9-450d-933a-1169f4deb0a4.webp?v=1782958610","width":2000},{"alt":null,"id":27656230469731,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_503f599d-e361-4ebd-84a1-c9db325067f2.webp?v=1782958611"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_503f599d-e361-4ebd-84a1-c9db325067f2.webp?v=1782958611","width":2000},{"alt":null,"id":27656231059555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1423e266-4d7f-48bd-903e-c8983a7330be.webp?v=1782958611"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1423e266-4d7f-48bd-903e-c8983a7330be.webp?v=1782958611","width":2000},{"alt":null,"id":27656231583843,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_c8aa9a9d-fda0-4786-8204-d106ffed412d.webp?v=1782958612"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_c8aa9a9d-fda0-4786-8204-d106ffed412d.webp?v=1782958612","width":2000},{"alt":null,"id":27656894349411,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_0de0f4ec-100e-4c8b-b544-5ea2fac618af.webp?v=1782961968"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_0de0f4ec-100e-4c8b-b544-5ea2fac618af.webp?v=1782961968","width":2000},{"alt":null,"id":27656895529059,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_0c52e2b1-4a4e-492d-bebb-e2978b425473.webp?v=1782961970"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_0c52e2b1-4a4e-492d-bebb-e2978b425473.webp?v=1782961970","width":2000},{"alt":null,"id":27656896479331,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_ce8312cf-7b9e-4403-a2bd-76d70d323b04.webp?v=1782961973"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_ce8312cf-7b9e-4403-a2bd-76d70d323b04.webp?v=1782961973","width":2000},{"alt":null,"id":27656897298531,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_8547af20-3b85-4ebe-9f89-a278748a807d.webp?v=1782961976"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_8547af20-3b85-4ebe-9f89-a278748a807d.webp?v=1782961976","width":2000},{"alt":null,"id":27656897691747,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_96bdd205-bc97-4da2-9ff1-00f1ea654f13.webp?v=1782961977"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_96bdd205-bc97-4da2-9ff1-00f1ea654f13.webp?v=1782961977","width":2000},{"alt":null,"id":27657391833187,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_192a746a-8be4-4706-9343-8edb40a6c981.webp?v=1782966277"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6a0d7c955078511c8dcfc6e0d0b7daa611f56ba_192a746a-8be4-4706-9343-8edb40a6c981.webp?v=1782966277","width":2000},{"alt":null,"id":27657392193635,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277","width":2000},{"alt":null,"id":27657392717923,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_c59d2f3b-46e4-43cb-af21-1b13f012ce83.webp?v=1782966278"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/136fcdbf8f6a050b795df90a979c0c330b1d6ef7_c59d2f3b-46e4-43cb-af21-1b13f012ce83.webp?v=1782966278","width":2000},{"alt":null,"id":27657393274979,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1c20493c-3a31-4317-ba45-2a74f36ebf47.webp?v=1782966278"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89a46258498da89143974faaf484164b92cec245_1c20493c-3a31-4317-ba45-2a74f36ebf47.webp?v=1782966278","width":2000},{"alt":null,"id":27657393700963,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_59e592a5-4bcf-4efb-9234-4994bcf71b14.webp?v=1782966279"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/835fbd56c1bb2610333156913749d948c8381f32_59e592a5-4bcf-4efb-9234-4994bcf71b14.webp?v=1782966279","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":44061591142499,"title":"Clear Pure","option1":"Clear Pure","option2":null,"option3":null,"sku":"MCX013945Q-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152518705251,"product_id":7980402802787,"position":18,"created_at":"2026-07-02T12:24:35+08:00","updated_at":"2026-07-02T12:24:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277","variant_ids":[44061591142499]},"available":true,"name":"iPhone 17 Pro ClearX (抗刮抗指紋加強版) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Clear Pure","public_title":"Clear Pure","options":["Clear Pure"],"price":178000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCX013525Q-PM14","featured_media":{"alt":null,"id":27657392193635,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":44061591142499,"title":"Clear Pure","option1":"Clear Pure","option2":null,"option3":null,"sku":"MCX013945Q-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152518705251,"product_id":7980402802787,"position":18,"created_at":"2026-07-02T12:24:35+08:00","updated_at":"2026-07-02T12:24:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277","variant_ids":[44061591142499]},"available":true,"name":"iPhone 17 Pro ClearX (抗刮抗指紋加強版) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Clear Pure","public_title":"Clear Pure","options":["Clear Pure"],"price":178000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MCX013525Q-PM14","featured_media":{"alt":null,"id":27657392193635,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23a7db9f8d7651f7207bbcf04b4a40072fd062bb_35bb01b1-59ca-4643-8cf0-ab835ba0f68c.webp?v=1782966277"}},"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: "停產" }