$product = {"id":7938077753443,"title":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 全員集結","handle":"iphone-12-pro-mod-nx-xw08","description":null,"published_at":"2025-12-12T09:59:52+08:00","created_at":"2025-12-11T16:58:34+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":43885014286435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750595683,"product_id":7938077753443,"position":10,"created_at":"2025-12-11T16:58:44+08:00","updated_at":"2025-12-11T16:58:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526","variant_ids":[43885014286435]},"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-XW08","featured_media":{"alt":null,"id":26496119832675,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017235555,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750038627,"product_id":7938077753443,"position":5,"created_at":"2025-12-11T16:58:42+08:00","updated_at":"2025-12-11T16:58:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524","variant_ids":[43885017235555]},"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-XW08","featured_media":{"alt":null,"id":26496119275619,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017268323,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933749710947,"product_id":7938077753443,"position":3,"created_at":"2025-12-11T16:58:41+08:00","updated_at":"2025-12-11T16:58:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523","variant_ids":[43885017268323]},"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-XW08","featured_media":{"alt":null,"id":26496118947939,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017301091,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933749842019,"product_id":7938077753443,"position":4,"created_at":"2025-12-11T16:58:41+08:00","updated_at":"2025-12-11T16:58:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523","variant_ids":[43885017301091]},"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-XW08","featured_media":{"alt":null,"id":26496119079011,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017432163,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750693987,"product_id":7938077753443,"position":11,"created_at":"2025-12-11T16:58:45+08:00","updated_at":"2025-12-11T16:58:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527","variant_ids":[43885017432163]},"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-XW08","featured_media":{"alt":null,"id":26496119930979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30371b2bf9950e964306bc553d914498e43d5b9a.webp?v=1765443522","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d08a921ba393f35581699df012e4d607fb7e54ab.webp?v=1765443522","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b5b2e9c9bc14fe0105adfd1d02cb3febf615881.webp?v=1765443524","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d49732d864c06008de99ea8ee9868fb1e272bb62.webp?v=1765443524","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d604d7cf9a2c6bad1fa18b65531a91ad105e7560.webp?v=1765443525","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a9ebf2a30122fc756906e0073220ced6223f9b1.webp?v=1765443526","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30371b2bf9950e964306bc553d914498e43d5b9a.webp?v=1765443522","options":["color"],"media":[{"alt":null,"id":26496118489187,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30371b2bf9950e964306bc553d914498e43d5b9a.webp?v=1765443522"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30371b2bf9950e964306bc553d914498e43d5b9a.webp?v=1765443522","width":2000},{"alt":null,"id":26496118718563,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d08a921ba393f35581699df012e4d607fb7e54ab.webp?v=1765443522"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d08a921ba393f35581699df012e4d607fb7e54ab.webp?v=1765443522","width":2000},{"alt":null,"id":26496118947939,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523","width":2000},{"alt":null,"id":26496119079011,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523","width":2000},{"alt":null,"id":26496119275619,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524","width":2000},{"alt":null,"id":26496119406691,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b5b2e9c9bc14fe0105adfd1d02cb3febf615881.webp?v=1765443524"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b5b2e9c9bc14fe0105adfd1d02cb3febf615881.webp?v=1765443524","width":2000},{"alt":null,"id":26496119472227,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d49732d864c06008de99ea8ee9868fb1e272bb62.webp?v=1765443524"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d49732d864c06008de99ea8ee9868fb1e272bb62.webp?v=1765443524","width":2000},{"alt":null,"id":26496119636067,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d604d7cf9a2c6bad1fa18b65531a91ad105e7560.webp?v=1765443525"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d604d7cf9a2c6bad1fa18b65531a91ad105e7560.webp?v=1765443525","width":2000},{"alt":null,"id":26496119734371,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a9ebf2a30122fc756906e0073220ced6223f9b1.webp?v=1765443526"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8a9ebf2a30122fc756906e0073220ced6223f9b1.webp?v=1765443526","width":2000},{"alt":null,"id":26496119832675,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526","width":2000},{"alt":null,"id":26496119930979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43885014286435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750595683,"product_id":7938077753443,"position":10,"created_at":"2025-12-11T16:58:44+08:00","updated_at":"2025-12-11T16:58:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526","variant_ids":[43885014286435]},"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-XW08","featured_media":{"alt":null,"id":26496119832675,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017235555,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750038627,"product_id":7938077753443,"position":5,"created_at":"2025-12-11T16:58:42+08:00","updated_at":"2025-12-11T16:58:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524","variant_ids":[43885017235555]},"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-XW08","featured_media":{"alt":null,"id":26496119275619,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04700f769623dc98230df3334508c6aa239319af.webp?v=1765443524"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017268323,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933749710947,"product_id":7938077753443,"position":3,"created_at":"2025-12-11T16:58:41+08:00","updated_at":"2025-12-11T16:58:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523","variant_ids":[43885017268323]},"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-XW08","featured_media":{"alt":null,"id":26496118947939,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/00a152458884d118afbca8d180dc57c0e2f07772.webp?v=1765443523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017301091,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933749842019,"product_id":7938077753443,"position":4,"created_at":"2025-12-11T16:58:41+08:00","updated_at":"2025-12-11T16:58:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523","variant_ids":[43885017301091]},"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-XW08","featured_media":{"alt":null,"id":26496119079011,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9433b556f486d2bf23b1cbec1ca81f59a825c1b5.webp?v=1765443523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885017432163,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750693987,"product_id":7938077753443,"position":11,"created_at":"2025-12-11T16:58:45+08:00","updated_at":"2025-12-11T16:58:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527","variant_ids":[43885017432163]},"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-XW08","featured_media":{"alt":null,"id":26496119930979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/afea2a35f147e3e50046831e90df0f1c189cdc96.webp?v=1765443527"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43885014286435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XW08","requires_shipping":true,"taxable":true,"featured_image":{"id":34933750595683,"product_id":7938077753443,"position":10,"created_at":"2025-12-11T16:58:44+08:00","updated_at":"2025-12-11T16:58:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526","variant_ids":[43885014286435]},"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-XW08","featured_media":{"alt":null,"id":26496119832675,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bccef25b127658836bac29f2640cca76a4e7a2b9.webp?v=1765443526"}},"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: "停產" }