$product = {"id":7873286406243,"title":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber","handle":"iphone-12-pro-mod-nx-printable-kei01","description":null,"published_at":"2025-09-01T10:47:49+08:00","created_at":"2025-09-01T09:44:08+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-keigo","device-iPhone 12 Pro","merge","reseller-keigo"],"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":43658613293155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409965289571,"product_id":7873286406243,"position":3,"created_at":"2025-09-01T09:44:13+08:00","updated_at":"2025-09-01T09:44:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055","variant_ids":[43658613293155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982280269923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613325923,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409966436451,"product_id":7873286406243,"position":9,"created_at":"2025-09-01T09:44:18+08:00","updated_at":"2025-09-01T09:44:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060","variant_ids":[43658613325923]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982281711715,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613424227,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409964929123,"product_id":7873286406243,"position":1,"created_at":"2025-09-01T09:44:12+08:00","updated_at":"2025-09-01T09:44:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054","variant_ids":[43658613424227]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982279909475,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613456995,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409967222883,"product_id":7873286406243,"position":10,"created_at":"2025-09-01T09:44:19+08:00","updated_at":"2025-09-01T09:44:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061","variant_ids":[43658613456995]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982282203235,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613555299,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409965158499,"product_id":7873286406243,"position":2,"created_at":"2025-09-01T09:44:13+08:00","updated_at":"2025-09-01T09:44:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055","variant_ids":[43658613555299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982280138851,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1cd168cf48b72560e1bee8397c07001335b980cd.webp?v=1756691056","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fb58a4df7be87571f2d7a1a03b0954b3e945f5.webp?v=1756691057","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/008b6a8328ccaeddcb05a3ed1fe9c859f6695a2e.webp?v=1756691057","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96fac35530cde0040cb18276a4bf80f5e2d95f8f.webp?v=1756691058","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/722e145cfb77b0f1afa56ea2965ceb2dc9c9668a.webp?v=1756691059","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c9933002b24cc364136a53729b65f952aa60a5c4.webp?v=1756691061"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054","options":["color"],"media":[{"alt":null,"id":25982279909475,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054","width":2000},{"alt":null,"id":25982280138851,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055","width":2000},{"alt":null,"id":25982280269923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055","width":2000},{"alt":null,"id":25982280499299,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1cd168cf48b72560e1bee8397c07001335b980cd.webp?v=1756691056"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1cd168cf48b72560e1bee8397c07001335b980cd.webp?v=1756691056","width":2000},{"alt":null,"id":25982280630371,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fb58a4df7be87571f2d7a1a03b0954b3e945f5.webp?v=1756691057"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fb58a4df7be87571f2d7a1a03b0954b3e945f5.webp?v=1756691057","width":2000},{"alt":null,"id":25982280761443,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/008b6a8328ccaeddcb05a3ed1fe9c859f6695a2e.webp?v=1756691057"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/008b6a8328ccaeddcb05a3ed1fe9c859f6695a2e.webp?v=1756691057","width":2000},{"alt":null,"id":25982280892515,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96fac35530cde0040cb18276a4bf80f5e2d95f8f.webp?v=1756691058"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96fac35530cde0040cb18276a4bf80f5e2d95f8f.webp?v=1756691058","width":2000},{"alt":null,"id":25982281187427,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/722e145cfb77b0f1afa56ea2965ceb2dc9c9668a.webp?v=1756691059"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/722e145cfb77b0f1afa56ea2965ceb2dc9c9668a.webp?v=1756691059","width":2000},{"alt":null,"id":25982281711715,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060","width":2000},{"alt":null,"id":25982282203235,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061","width":2000},{"alt":null,"id":25982282334307,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c9933002b24cc364136a53729b65f952aa60a5c4.webp?v=1756691061"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c9933002b24cc364136a53729b65f952aa60a5c4.webp?v=1756691061","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43658613293155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409965289571,"product_id":7873286406243,"position":3,"created_at":"2025-09-01T09:44:13+08:00","updated_at":"2025-09-01T09:44:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055","variant_ids":[43658613293155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982280269923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613325923,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409966436451,"product_id":7873286406243,"position":9,"created_at":"2025-09-01T09:44:18+08:00","updated_at":"2025-09-01T09:44:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060","variant_ids":[43658613325923]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982281711715,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0931fb6eddbf6925d8458a70faeadecb14760ce.webp?v=1756691060"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613424227,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409964929123,"product_id":7873286406243,"position":1,"created_at":"2025-09-01T09:44:12+08:00","updated_at":"2025-09-01T09:44:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054","variant_ids":[43658613424227]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982279909475,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3b5c031ad96a91f0658f306b9d3e734c6d75ed9.webp?v=1756691054"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613456995,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409967222883,"product_id":7873286406243,"position":10,"created_at":"2025-09-01T09:44:19+08:00","updated_at":"2025-09-01T09:44:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061","variant_ids":[43658613456995]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982282203235,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f32dedbdc85101e8152e43854ac495ce0315556c.webp?v=1756691061"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658613555299,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409965158499,"product_id":7873286406243,"position":2,"created_at":"2025-09-01T09:44:13+08:00","updated_at":"2025-09-01T09:44:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055","variant_ids":[43658613555299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982280138851,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b0d02ea0019153db714aca2b96d267e963afafb.webp?v=1756691055"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43658613293155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI01","requires_shipping":true,"taxable":true,"featured_image":{"id":34409965289571,"product_id":7873286406243,"position":3,"created_at":"2025-09-01T09:44:13+08:00","updated_at":"2025-09-01T09:44:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055","variant_ids":[43658613293155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Barber - 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-KEI01","featured_media":{"alt":null,"id":25982280269923,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/386e12e1d1dbcb44eb288240158cd54c02074bfa.webp?v=1756691055"}},"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: "停產" }