$product = {"id":7938032173155,"title":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴","handle":"iphone-12-pro-mod-nx-xw10","description":null,"published_at":"2025-12-12T10:09:43+08:00","created_at":"2025-12-11T16:47:09+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-attack-on-titan","device-iPhone 12 Pro","merge","reseller-attack-on-titan"],"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":43884835668067,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570961507,"product_id":7938032173155,"position":6,"created_at":"2025-12-11T16:47:15+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837","variant_ids":[43884835668067]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941083235,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839075939,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570601059,"product_id":7938032173155,"position":4,"created_at":"2025-12-11T16:47:14+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837","variant_ids":[43884839075939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495940821091,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839108707,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933571518563,"product_id":7938032173155,"position":10,"created_at":"2025-12-11T16:47:19+08:00","updated_at":"2025-12-11T16:47:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841","variant_ids":[43884839108707]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941640291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839141475,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570240611,"product_id":7938032173155,"position":2,"created_at":"2025-12-11T16:47:13+08:00","updated_at":"2025-12-11T16:47:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835","variant_ids":[43884839141475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495940427875,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839272547,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933571027043,"product_id":7938032173155,"position":7,"created_at":"2025-12-11T16:47:15+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837","variant_ids":[43884839272547]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941148771,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f78172fd4e5aa4b8383ffc3bac278c855e2b44bb.webp?v=1765442835","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fcf03e42409cf5e833f349f5af4767d9c0cbbb.webp?v=1765442835","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7e6a206580133392a960aab376d132a7367a4ff.webp?v=1765442836","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/628d0df014072cd1378d342781284bf5353a5ae6.webp?v=1765442838","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1175a123ee6a73ae5f80608234d01bd9dfbfb063.webp?v=1765442840","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ecf7210cac11fa13e937251d3de1f8679c6ec59.webp?v=1765442841"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f78172fd4e5aa4b8383ffc3bac278c855e2b44bb.webp?v=1765442835","options":["color"],"media":[{"alt":null,"id":26495940362339,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f78172fd4e5aa4b8383ffc3bac278c855e2b44bb.webp?v=1765442835"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f78172fd4e5aa4b8383ffc3bac278c855e2b44bb.webp?v=1765442835","width":2000},{"alt":null,"id":26495940427875,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835","width":2000},{"alt":null,"id":26495940657251,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fcf03e42409cf5e833f349f5af4767d9c0cbbb.webp?v=1765442835"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69fcf03e42409cf5e833f349f5af4767d9c0cbbb.webp?v=1765442835","width":2000},{"alt":null,"id":26495940821091,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837","width":2000},{"alt":null,"id":26495941017699,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7e6a206580133392a960aab376d132a7367a4ff.webp?v=1765442836"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7e6a206580133392a960aab376d132a7367a4ff.webp?v=1765442836","width":2000},{"alt":null,"id":26495941083235,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837","width":2000},{"alt":null,"id":26495941148771,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837","width":2000},{"alt":null,"id":26495941214307,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/628d0df014072cd1378d342781284bf5353a5ae6.webp?v=1765442838"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/628d0df014072cd1378d342781284bf5353a5ae6.webp?v=1765442838","width":2000},{"alt":null,"id":26495941312611,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1175a123ee6a73ae5f80608234d01bd9dfbfb063.webp?v=1765442840"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1175a123ee6a73ae5f80608234d01bd9dfbfb063.webp?v=1765442840","width":2000},{"alt":null,"id":26495941640291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841","width":2000},{"alt":null,"id":26495941935203,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ecf7210cac11fa13e937251d3de1f8679c6ec59.webp?v=1765442841"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ecf7210cac11fa13e937251d3de1f8679c6ec59.webp?v=1765442841","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43884835668067,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570961507,"product_id":7938032173155,"position":6,"created_at":"2025-12-11T16:47:15+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837","variant_ids":[43884835668067]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941083235,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839075939,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570601059,"product_id":7938032173155,"position":4,"created_at":"2025-12-11T16:47:14+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837","variant_ids":[43884839075939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495940821091,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/76cea6a446a0ef2a9fd019b0745f1b4605be5124.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839108707,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933571518563,"product_id":7938032173155,"position":10,"created_at":"2025-12-11T16:47:19+08:00","updated_at":"2025-12-11T16:47:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841","variant_ids":[43884839108707]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941640291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102074d66c8781b392dc215414c7799f2fcb32e2.webp?v=1765442841"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839141475,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570240611,"product_id":7938032173155,"position":2,"created_at":"2025-12-11T16:47:13+08:00","updated_at":"2025-12-11T16:47:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835","variant_ids":[43884839141475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495940427875,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a096d6f79dae7644b30cd03e288d34d0ddd44a1d.webp?v=1765442835"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884839272547,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933571027043,"product_id":7938032173155,"position":7,"created_at":"2025-12-11T16:47:15+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837","variant_ids":[43884839272547]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941148771,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6a47ca45f6f690af60646bf75533df372e19fac.webp?v=1765442837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43884835668067,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933570961507,"product_id":7938032173155,"position":6,"created_at":"2025-12-11T16:47:15+08:00","updated_at":"2025-12-11T16:47:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837","variant_ids":[43884835668067]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 地鳴 - 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-XW10","featured_media":{"alt":null,"id":26495941083235,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/01ab7b2fea336d98811ae7842402e4f5cf474188.webp?v=1765442837"}},"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: "停產" }