$product = {"id":7159685677155,"title":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks","handle":"iphone-14-pro-jellytint-magsafe-pm14","description":null,"published_at":"2024-02-01T08:54:30+08:00","created_at":"2024-01-26T18:42:06+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 14 Pro","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":41215938363491,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MCN012620G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152352571491,"product_id":7159685677155,"position":17,"created_at":"2026-07-02T12:16:50+08:00","updated_at":"2026-07-02T12:16:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812","variant_ids":[41215938363491]},"available":true,"name":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":1680,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN012620G-PM14","featured_media":{"alt":null,"id":27657226027107,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41215938429027,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"MCN012620I-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152351096931,"product_id":7159685677155,"position":15,"created_at":"2026-07-02T12:16:48+08:00","updated_at":"2026-07-02T12:16:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810","variant_ids":[41215938429027]},"available":true,"name":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":148000,"weight":1680,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN012620I-PM14","featured_media":{"alt":null,"id":27657224552547,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-262-PM14_4b7e9408-1eed-4e6a-ac52-6ed1ff45ea7a.png?v=1706265729","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4.webp?v=1782207162","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da.webp?v=1782207163","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c.webp?v=1782207163","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143.webp?v=1782207164","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6eb52f88-40c3-4b08-bf03-284ada2f3e58.webp?v=1782957828","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5553ba96-27ac-4d5b-99b3-afe877c6bf2d.webp?v=1782957829","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_a9311e5d-a980-4b24-bba5-cb5b0f876eb8.webp?v=1782957829","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_477cd6ae-e461-4cc5-a04d-6ebbd254c877.webp?v=1782957830","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6e67a32a-0e8b-460d-85d8-2b99d0a14269.webp?v=1782961397","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5db49ee4-c0e2-4f09-bbe4-cee5d3141dec.webp?v=1782961398","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_fcde0c34-963d-4577-96f1-9fb09301008f.webp?v=1782961400","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_7361f5a3-9e3e-4691-81a5-157894af8318.webp?v=1782961401","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_d0f77d72-4f16-4d2c-a623-80211db184a3.webp?v=1782965810","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_cb44ffcb-c412-47d8-a929-fda0015ed226.webp?v=1782965811","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-262-PM14_4b7e9408-1eed-4e6a-ac52-6ed1ff45ea7a.png?v=1706265729","options":["color"],"media":[{"alt":null,"id":23220052066403,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-262-PM14_4b7e9408-1eed-4e6a-ac52-6ed1ff45ea7a.png?v=1706265729"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-262-PM14_4b7e9408-1eed-4e6a-ac52-6ed1ff45ea7a.png?v=1706265729","width":2000},{"alt":null,"id":27575831658595,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4.webp?v=1782207162"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4.webp?v=1782207162","width":2000},{"alt":null,"id":27575831789667,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da.webp?v=1782207163"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da.webp?v=1782207163","width":2000},{"alt":null,"id":27575831920739,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c.webp?v=1782207163"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c.webp?v=1782207163","width":2000},{"alt":null,"id":27575832248419,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143.webp?v=1782207164"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143.webp?v=1782207164","width":2000},{"alt":null,"id":27655935131747,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6eb52f88-40c3-4b08-bf03-284ada2f3e58.webp?v=1782957828"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6eb52f88-40c3-4b08-bf03-284ada2f3e58.webp?v=1782957828","width":2000},{"alt":null,"id":27655935426659,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5553ba96-27ac-4d5b-99b3-afe877c6bf2d.webp?v=1782957829"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5553ba96-27ac-4d5b-99b3-afe877c6bf2d.webp?v=1782957829","width":2000},{"alt":null,"id":27655935983715,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_a9311e5d-a980-4b24-bba5-cb5b0f876eb8.webp?v=1782957829"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_a9311e5d-a980-4b24-bba5-cb5b0f876eb8.webp?v=1782957829","width":2000},{"alt":null,"id":27655936245859,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_477cd6ae-e461-4cc5-a04d-6ebbd254c877.webp?v=1782957830"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_477cd6ae-e461-4cc5-a04d-6ebbd254c877.webp?v=1782957830","width":2000},{"alt":null,"id":27656752136291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6e67a32a-0e8b-460d-85d8-2b99d0a14269.webp?v=1782961397"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_6e67a32a-0e8b-460d-85d8-2b99d0a14269.webp?v=1782961397","width":2000},{"alt":null,"id":27656752922723,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5db49ee4-c0e2-4f09-bbe4-cee5d3141dec.webp?v=1782961398"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_5db49ee4-c0e2-4f09-bbe4-cee5d3141dec.webp?v=1782961398","width":2000},{"alt":null,"id":27656753578083,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_fcde0c34-963d-4577-96f1-9fb09301008f.webp?v=1782961400"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_fcde0c34-963d-4577-96f1-9fb09301008f.webp?v=1782961400","width":2000},{"alt":null,"id":27656754397283,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_7361f5a3-9e3e-4691-81a5-157894af8318.webp?v=1782961401"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_7361f5a3-9e3e-4691-81a5-157894af8318.webp?v=1782961401","width":2000},{"alt":null,"id":27657224028259,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_d0f77d72-4f16-4d2c-a623-80211db184a3.webp?v=1782965810"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc7cc4e9951dc9d23e79740e9a8796400c70a4da_d0f77d72-4f16-4d2c-a623-80211db184a3.webp?v=1782965810","width":2000},{"alt":null,"id":27657224552547,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810","width":2000},{"alt":null,"id":27657225437283,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_cb44ffcb-c412-47d8-a929-fda0015ed226.webp?v=1782965811"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d780e64e535738e61dea245b0a8b80579feacdf4_cb44ffcb-c412-47d8-a929-fda0015ed226.webp?v=1782965811","width":2000},{"alt":null,"id":27657226027107,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":41215938363491,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MCN012620G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152352571491,"product_id":7159685677155,"position":17,"created_at":"2026-07-02T12:16:50+08:00","updated_at":"2026-07-02T12:16:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812","variant_ids":[41215938363491]},"available":true,"name":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":1680,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN012620G-PM14","featured_media":{"alt":null,"id":27657226027107,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41215938429027,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"MCN012620I-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152351096931,"product_id":7159685677155,"position":15,"created_at":"2026-07-02T12:16:48+08:00","updated_at":"2026-07-02T12:16:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810","variant_ids":[41215938429027]},"available":true,"name":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":148000,"weight":1680,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN012620I-PM14","featured_media":{"alt":null,"id":27657224552547,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bfdb5ae28e006eaf6ec044ad21cf854e989a143_1213b4d8-5fb1-4330-8d3f-357019ece398.webp?v=1782965810"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":41215938363491,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MCN012620G-PM14","requires_shipping":true,"taxable":true,"featured_image":{"id":36152352571491,"product_id":7159685677155,"position":17,"created_at":"2026-07-02T12:16:50+08:00","updated_at":"2026-07-02T12:16:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812","variant_ids":[41215938363491]},"available":true,"name":"iPhone 14 Pro Clear (MagSafe 兼容) NBA Logo-密爾瓦基公鹿 Milwaukee Bucks - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":1680,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MCN012620G-PM14","featured_media":{"alt":null,"id":27657226027107,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a97110c1776bc9ee5f91a0c37cb46649dd37058c_a9dc23c6-a80c-45dd-9d0f-bb4f7d356c3e.webp?v=1782965812"}},"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: "停產" }