$product = {"id":7942061195363,"title":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對","handle":"iphone-12-pro-mod-nx-nya05","description":null,"published_at":"2025-12-23T10:04:55+08:00","created_at":"2025-12-22T11:37:52+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nyangsongi","device-iPhone 12 Pro","merge","reseller-nyangsongi"],"price":90000,"price_min":90000,"price_max":90000,"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":43903291621475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920397411,"product_id":7942061195363,"position":5,"created_at":"2025-12-22T11:38:32+08:00","updated_at":"2025-12-22T11:38:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714","variant_ids":[43903291621475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-NYA05","featured_media":{"alt":null,"id":26546996478051,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903291785315,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920528483,"product_id":7942061195363,"position":6,"created_at":"2025-12-22T11:38:32+08:00","updated_at":"2025-12-22T11:38:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714","variant_ids":[43903291785315]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-NYA05","featured_media":{"alt":null,"id":26546996609123,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903291949155,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920004195,"product_id":7942061195363,"position":2,"created_at":"2025-12-22T11:38:30+08:00","updated_at":"2025-12-22T11:38:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712","variant_ids":[43903291949155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-NYA05","featured_media":{"alt":null,"id":26546996052067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903292342371,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985921511523,"product_id":7942061195363,"position":10,"created_at":"2025-12-22T11:38:35+08:00","updated_at":"2025-12-22T11:38:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717","variant_ids":[43903292342371]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-NYA05","featured_media":{"alt":null,"id":26546997166179,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903292899427,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920135267,"product_id":7942061195363,"position":3,"created_at":"2025-12-22T11:38:31+08:00","updated_at":"2025-12-22T11:38:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713","variant_ids":[43903292899427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-NYA05","featured_media":{"alt":null,"id":26546996183139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/450f20918c0e0308326f820a9c212f1902814f87.webp?v=1766374712","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf37e46524f433bcab8a2ddcb889c5a6333165fc.webp?v=1766374713","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01f19adce37f796f40771e51615185f4290ab44.webp?v=1766374715","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eab6e0c360998f4f039a426a2b02afb55d496f1d.webp?v=1766374715","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/216645ed2e2cad28236e1051a1ca38d0918228b2.webp?v=1766374716","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68dc326d7510b58952a73b7727207db3b5482200.webp?v=1766374717"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/450f20918c0e0308326f820a9c212f1902814f87.webp?v=1766374712","options":["color"],"media":[{"alt":null,"id":26546995920995,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/450f20918c0e0308326f820a9c212f1902814f87.webp?v=1766374712"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/450f20918c0e0308326f820a9c212f1902814f87.webp?v=1766374712","width":2000},{"alt":null,"id":26546996052067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712","width":2000},{"alt":null,"id":26546996183139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713","width":2000},{"alt":null,"id":26546996346979,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf37e46524f433bcab8a2ddcb889c5a6333165fc.webp?v=1766374713"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bf37e46524f433bcab8a2ddcb889c5a6333165fc.webp?v=1766374713","width":2000},{"alt":null,"id":26546996478051,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714","width":2000},{"alt":null,"id":26546996609123,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714","width":2000},{"alt":null,"id":26546996772963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01f19adce37f796f40771e51615185f4290ab44.webp?v=1766374715"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01f19adce37f796f40771e51615185f4290ab44.webp?v=1766374715","width":2000},{"alt":null,"id":26546996871267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eab6e0c360998f4f039a426a2b02afb55d496f1d.webp?v=1766374715"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eab6e0c360998f4f039a426a2b02afb55d496f1d.webp?v=1766374715","width":2000},{"alt":null,"id":26546997035107,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/216645ed2e2cad28236e1051a1ca38d0918228b2.webp?v=1766374716"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/216645ed2e2cad28236e1051a1ca38d0918228b2.webp?v=1766374716","width":2000},{"alt":null,"id":26546997166179,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717","width":2000},{"alt":null,"id":26546997297251,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68dc326d7510b58952a73b7727207db3b5482200.webp?v=1766374717"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/68dc326d7510b58952a73b7727207db3b5482200.webp?v=1766374717","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43903291621475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920397411,"product_id":7942061195363,"position":5,"created_at":"2025-12-22T11:38:32+08:00","updated_at":"2025-12-22T11:38:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714","variant_ids":[43903291621475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-NYA05","featured_media":{"alt":null,"id":26546996478051,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903291785315,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920528483,"product_id":7942061195363,"position":6,"created_at":"2025-12-22T11:38:32+08:00","updated_at":"2025-12-22T11:38:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714","variant_ids":[43903291785315]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185J5-NYA05","featured_media":{"alt":null,"id":26546996609123,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f994a7014a57be887ead80bbff9f0391fb8a4dd3.webp?v=1766374714"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903291949155,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920004195,"product_id":7942061195363,"position":2,"created_at":"2025-12-22T11:38:30+08:00","updated_at":"2025-12-22T11:38:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712","variant_ids":[43903291949155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118524-NYA05","featured_media":{"alt":null,"id":26546996052067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef354298393075f35208f7a1a92ee14085121b8c.webp?v=1766374712"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903292342371,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985921511523,"product_id":7942061195363,"position":10,"created_at":"2025-12-22T11:38:35+08:00","updated_at":"2025-12-22T11:38:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717","variant_ids":[43903292342371]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118569-NYA05","featured_media":{"alt":null,"id":26546997166179,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/109c40437ca5414698010fc33b59b9c1d94982d5.webp?v=1766374717"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43903292899427,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920135267,"product_id":7942061195363,"position":3,"created_at":"2025-12-22T11:38:31+08:00","updated_at":"2025-12-22T11:38:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713","variant_ids":[43903292899427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118504-NYA05","featured_media":{"alt":null,"id":26546996183139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8f08290b577dd8950d2c22e83dc82079571da39e.webp?v=1766374713"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43903291621475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-NYA05","requires_shipping":true,"taxable":true,"featured_image":{"id":34985920397411,"product_id":7942061195363,"position":5,"created_at":"2025-12-22T11:38:32+08:00","updated_at":"2025-12-22T11:38:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714","variant_ids":[43903291621475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Nyangsongi 野餐派對 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01185C1-NYA05","featured_media":{"alt":null,"id":26546996478051,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d1c8118b654f37855732deb9660b8474aa0e5f.webp?v=1766374714"}},"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: "停產" }