$product = {"id":7951285583971,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly","handle":"iphone-12-pro-mod-nx-magsafe-tan04","description":null,"published_at":"2026-01-13T10:18:31+08:00","created_at":"2026-01-12T17:09:52+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-tanakashen","device-iPhone 12 Pro","merge","reseller-tanakashen"],"price":110000,"price_min":110000,"price_max":110000,"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":43946235461731,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093958393955,"product_id":7951285583971,"position":2,"created_at":"2026-01-12T17:09:56+08:00","updated_at":"2026-01-12T17:09:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998","variant_ids":[43946235461731]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-TAN04","featured_media":{"alt":null,"id":26650614202467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239393891,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093960851555,"product_id":7951285583971,"position":11,"created_at":"2026-01-12T17:10:01+08:00","updated_at":"2026-01-12T17:10:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003","variant_ids":[43946239393891]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-TAN04","featured_media":{"alt":null,"id":26650616660067,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239459427,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093959442531,"product_id":7951285583971,"position":6,"created_at":"2026-01-12T17:09:59+08:00","updated_at":"2026-01-12T17:10:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001","variant_ids":[43946239459427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-TAN04","featured_media":{"alt":null,"id":26650615218275,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239524963,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093958197347,"product_id":7951285583971,"position":1,"created_at":"2026-01-12T17:09:56+08:00","updated_at":"2026-01-12T17:09:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998","variant_ids":[43946239524963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-TAN04","featured_media":{"alt":null,"id":26650614005859,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239623267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093960556643,"product_id":7951285583971,"position":10,"created_at":"2026-01-12T17:10:01+08:00","updated_at":"2026-01-12T17:10:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002","variant_ids":[43946239623267]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-TAN04","featured_media":{"alt":null,"id":26650616430691,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bf7546d0d6389887c4d5fd7d081ddc3eb0449fd.webp?v=1768208999","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51995d0dc82e8bc946b1845a0c0c0eb755eab6f5.webp?v=1768208999","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/677767bd788f1e44c2f416c5b9157a08d192089d.webp?v=1768209000","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e35564b64b9228e0c8761effc032c75f34df609.webp?v=1768209001","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd09343d1e14a7755fceca2341822c7511fc1fd0.webp?v=1768209002","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2046a8f9292ed22e9bb80e4cd23c6747b362a0de.webp?v=1768209002","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998","options":["color"],"media":[{"alt":null,"id":26650614005859,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998","width":2000},{"alt":null,"id":26650614202467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998","width":2000},{"alt":null,"id":26650614464611,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bf7546d0d6389887c4d5fd7d081ddc3eb0449fd.webp?v=1768208999"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1bf7546d0d6389887c4d5fd7d081ddc3eb0449fd.webp?v=1768208999","width":2000},{"alt":null,"id":26650614661219,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51995d0dc82e8bc946b1845a0c0c0eb755eab6f5.webp?v=1768208999"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51995d0dc82e8bc946b1845a0c0c0eb755eab6f5.webp?v=1768208999","width":2000},{"alt":null,"id":26650614857827,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/677767bd788f1e44c2f416c5b9157a08d192089d.webp?v=1768209000"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/677767bd788f1e44c2f416c5b9157a08d192089d.webp?v=1768209000","width":2000},{"alt":null,"id":26650615218275,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001","width":2000},{"alt":null,"id":26650615513187,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e35564b64b9228e0c8761effc032c75f34df609.webp?v=1768209001"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e35564b64b9228e0c8761effc032c75f34df609.webp?v=1768209001","width":2000},{"alt":null,"id":26650615808099,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd09343d1e14a7755fceca2341822c7511fc1fd0.webp?v=1768209002"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd09343d1e14a7755fceca2341822c7511fc1fd0.webp?v=1768209002","width":2000},{"alt":null,"id":26650616103011,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2046a8f9292ed22e9bb80e4cd23c6747b362a0de.webp?v=1768209002"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2046a8f9292ed22e9bb80e4cd23c6747b362a0de.webp?v=1768209002","width":2000},{"alt":null,"id":26650616430691,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002","width":2000},{"alt":null,"id":26650616660067,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43946235461731,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093958393955,"product_id":7951285583971,"position":2,"created_at":"2026-01-12T17:09:56+08:00","updated_at":"2026-01-12T17:09:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998","variant_ids":[43946235461731]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-TAN04","featured_media":{"alt":null,"id":26650614202467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239393891,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093960851555,"product_id":7951285583971,"position":11,"created_at":"2026-01-12T17:10:01+08:00","updated_at":"2026-01-12T17:10:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003","variant_ids":[43946239393891]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-TAN04","featured_media":{"alt":null,"id":26650616660067,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d91294af20fd068e8970e9934490b79e4c3dba1.webp?v=1768209003"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239459427,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093959442531,"product_id":7951285583971,"position":6,"created_at":"2026-01-12T17:09:59+08:00","updated_at":"2026-01-12T17:10:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001","variant_ids":[43946239459427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-TAN04","featured_media":{"alt":null,"id":26650615218275,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/889bcd2993f4be20a6c34fc5d189053ba348f146.webp?v=1768209001"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239524963,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093958197347,"product_id":7951285583971,"position":1,"created_at":"2026-01-12T17:09:56+08:00","updated_at":"2026-01-12T17:09:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998","variant_ids":[43946239524963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-TAN04","featured_media":{"alt":null,"id":26650614005859,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c36b0081e0b796a4372fd4e22803599c2e2cb80.webp?v=1768208998"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43946239623267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093960556643,"product_id":7951285583971,"position":10,"created_at":"2026-01-12T17:10:01+08:00","updated_at":"2026-01-12T17:10:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002","variant_ids":[43946239623267]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-TAN04","featured_media":{"alt":null,"id":26650616430691,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a75573738758953606cd63f22d30500f59e0f03.webp?v=1768209002"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43946235461731,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-TAN04","requires_shipping":true,"taxable":true,"featured_image":{"id":35093958393955,"product_id":7951285583971,"position":2,"created_at":"2026-01-12T17:09:56+08:00","updated_at":"2026-01-12T17:09:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998","variant_ids":[43946235461731]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 田中 Shen Sparkly - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-TAN04","featured_media":{"alt":null,"id":26650614202467,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0ea5790540f42df1658498fd3c590b4c9cc74692.webp?v=1768208998"}},"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: "停產" }