$product = {"id":7956207665251,"title":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花","handle":"iphone-12-pro-mod-nx-eme04","description":null,"published_at":"2026-01-28T09:43:06+08:00","created_at":"2026-01-26T14:38:41+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-emerald","device-iPhone 12 Pro","merge","reseller-emerald"],"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":43966965284963,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189420131,"product_id":7956207665251,"position":8,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568","variant_ids":[43966965284963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427928163,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978654307,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188600931,"product_id":7956207665251,"position":3,"created_at":"2026-01-26T14:39:24+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566","variant_ids":[43966978654307]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427076195,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978818147,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189256291,"product_id":7956207665251,"position":7,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568","variant_ids":[43966978818147]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427764323,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966979375203,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188371555,"product_id":7956207665251,"position":1,"created_at":"2026-01-26T14:39:23+08:00","updated_at":"2026-01-26T14:39:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565","variant_ids":[43966979375203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703426879587,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966980030563,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189092451,"product_id":7956207665251,"position":6,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567","variant_ids":[43966980030563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427600483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b6712eb3664f6dafe009031d3b9403ff1191c21.webp?v=1769409565","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da745be3d6762ab4cc3ded0e3611d50008b316f4.webp?v=1769409566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3bfb33e3533d8e01d99a800a7ad40b16a89d40b.webp?v=1769409567","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf42af30c06d84a765b79672d1a18f024f15848e.webp?v=1769409568","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c11c75904d52e75a3f1cd110bf0a00fd58aeae.webp?v=1769409569","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a76f432cc33df9b914b153ed3ee4842df6ae86a.webp?v=1769409570"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565","options":["color"],"media":[{"alt":null,"id":26703426879587,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565","width":2000},{"alt":null,"id":26703426977891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b6712eb3664f6dafe009031d3b9403ff1191c21.webp?v=1769409565"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b6712eb3664f6dafe009031d3b9403ff1191c21.webp?v=1769409565","width":2000},{"alt":null,"id":26703427076195,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566","width":2000},{"alt":null,"id":26703427207267,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da745be3d6762ab4cc3ded0e3611d50008b316f4.webp?v=1769409566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/da745be3d6762ab4cc3ded0e3611d50008b316f4.webp?v=1769409566","width":2000},{"alt":null,"id":26703427305571,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3bfb33e3533d8e01d99a800a7ad40b16a89d40b.webp?v=1769409567"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3bfb33e3533d8e01d99a800a7ad40b16a89d40b.webp?v=1769409567","width":2000},{"alt":null,"id":26703427600483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567","width":2000},{"alt":null,"id":26703427764323,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568","width":2000},{"alt":null,"id":26703427928163,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568","width":2000},{"alt":null,"id":26703428092003,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf42af30c06d84a765b79672d1a18f024f15848e.webp?v=1769409568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf42af30c06d84a765b79672d1a18f024f15848e.webp?v=1769409568","width":2000},{"alt":null,"id":26703428354147,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c11c75904d52e75a3f1cd110bf0a00fd58aeae.webp?v=1769409569"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c11c75904d52e75a3f1cd110bf0a00fd58aeae.webp?v=1769409569","width":2000},{"alt":null,"id":26703428583523,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a76f432cc33df9b914b153ed3ee4842df6ae86a.webp?v=1769409570"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a76f432cc33df9b914b153ed3ee4842df6ae86a.webp?v=1769409570","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43966965284963,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189420131,"product_id":7956207665251,"position":8,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568","variant_ids":[43966965284963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427928163,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978654307,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188600931,"product_id":7956207665251,"position":3,"created_at":"2026-01-26T14:39:24+08:00","updated_at":"2026-01-26T14:39:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566","variant_ids":[43966978654307]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427076195,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1379cc95fae123c7ddd7e93c828a727188b8d07.webp?v=1769409566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966978818147,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189256291,"product_id":7956207665251,"position":7,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568","variant_ids":[43966978818147]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427764323,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d34a3b4c54fa834018f547751b11472d6d5b295e.webp?v=1769409568"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966979375203,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147188371555,"product_id":7956207665251,"position":1,"created_at":"2026-01-26T14:39:23+08:00","updated_at":"2026-01-26T14:39:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565","variant_ids":[43966979375203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703426879587,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d4ac28cc9d6d0db67b8f4ab7ae3a356ad4f2891.webp?v=1769409565"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966980030563,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189092451,"product_id":7956207665251,"position":6,"created_at":"2026-01-26T14:39:25+08:00","updated_at":"2026-01-26T14:39:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567","variant_ids":[43966980030563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427600483,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87c484c0be580f57f8fe5d1008d303fa5ac1a7ea.webp?v=1769409567"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43966965284963,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-EME04","requires_shipping":true,"taxable":true,"featured_image":{"id":35147189420131,"product_id":7956207665251,"position":8,"created_at":"2026-01-26T14:39:26+08:00","updated_at":"2026-01-26T14:39:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568","variant_ids":[43966965284963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Emerald Studio 4月 含笑花 - 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-EME04","featured_media":{"alt":null,"id":26703427928163,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bac37aa8decd40cbcf9808f92efcfc148e251cbc.webp?v=1769409568"}},"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: "停產" }