$product = {"id":7838064509027,"title":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸","handle":"iphone-12-pro-mod-nx-hk66","description":null,"published_at":"2025-07-16T11:47:18+08:00","created_at":"2025-07-16T09:49:12+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-bounce","device-iPhone 12 Pro","merge","reseller-bounce"],"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":43528672051299,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193366188131,"product_id":7838064509027,"position":1,"created_at":"2025-07-16T09:49:16+08:00","updated_at":"2025-07-16T09:49:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","variant_ids":[43528672051299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827417227363,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675164259,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193370677347,"product_id":7838064509027,"position":11,"created_at":"2025-07-16T09:49:22+08:00","updated_at":"2025-07-16T09:49:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564","variant_ids":[43528675164259]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827420176483,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675197027,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193367400547,"product_id":7838064509027,"position":3,"created_at":"2025-07-16T09:49:18+08:00","updated_at":"2025-07-16T09:49:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560","variant_ids":[43528675197027]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827418210403,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675295331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193369071715,"product_id":7838064509027,"position":6,"created_at":"2025-07-16T09:49:19+08:00","updated_at":"2025-07-16T09:49:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561","variant_ids":[43528675295331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827418964067,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675459171,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193370382435,"product_id":7838064509027,"position":10,"created_at":"2025-07-16T09:49:21+08:00","updated_at":"2025-07-16T09:49:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563","variant_ids":[43528675459171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827419979875,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b7da27c4ee6c6b10e5e2bc0ea0200fa38c0800a.webp?v=1752630559","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2703c52b9410de5e93a4238f99722300124cc24.webp?v=1752630560","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb1620ae26011ce7b9942c66b62e925bfa72af24.webp?v=1752630561","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d3f3f056c3aa4e49a49bc7e2d09074052af87a8.webp?v=1752630562","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0d21bb078136dc6cc8ca8948bb83dc34b8e598df.webp?v=1752630562","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1824dd31f60c03150c10f4681e06720afbf4141d.webp?v=1752630563","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","options":["color"],"media":[{"alt":null,"id":25827417227363,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","width":2000},{"alt":null,"id":25827417981027,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b7da27c4ee6c6b10e5e2bc0ea0200fa38c0800a.webp?v=1752630559"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b7da27c4ee6c6b10e5e2bc0ea0200fa38c0800a.webp?v=1752630559","width":2000},{"alt":null,"id":25827418210403,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560","width":2000},{"alt":null,"id":25827418472547,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2703c52b9410de5e93a4238f99722300124cc24.webp?v=1752630560"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2703c52b9410de5e93a4238f99722300124cc24.webp?v=1752630560","width":2000},{"alt":null,"id":25827418800227,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb1620ae26011ce7b9942c66b62e925bfa72af24.webp?v=1752630561"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fb1620ae26011ce7b9942c66b62e925bfa72af24.webp?v=1752630561","width":2000},{"alt":null,"id":25827418964067,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561","width":2000},{"alt":null,"id":25827419193443,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d3f3f056c3aa4e49a49bc7e2d09074052af87a8.webp?v=1752630562"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d3f3f056c3aa4e49a49bc7e2d09074052af87a8.webp?v=1752630562","width":2000},{"alt":null,"id":25827419390051,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0d21bb078136dc6cc8ca8948bb83dc34b8e598df.webp?v=1752630562"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0d21bb078136dc6cc8ca8948bb83dc34b8e598df.webp?v=1752630562","width":2000},{"alt":null,"id":25827419586659,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1824dd31f60c03150c10f4681e06720afbf4141d.webp?v=1752630563"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1824dd31f60c03150c10f4681e06720afbf4141d.webp?v=1752630563","width":2000},{"alt":null,"id":25827419979875,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563","width":2000},{"alt":null,"id":25827420176483,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43528672051299,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193366188131,"product_id":7838064509027,"position":1,"created_at":"2025-07-16T09:49:16+08:00","updated_at":"2025-07-16T09:49:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","variant_ids":[43528672051299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827417227363,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675164259,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193370677347,"product_id":7838064509027,"position":11,"created_at":"2025-07-16T09:49:22+08:00","updated_at":"2025-07-16T09:49:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564","variant_ids":[43528675164259]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827420176483,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60392c8eba549ed988df3156361e7f6b6bd99d7a.webp?v=1752630564"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675197027,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193367400547,"product_id":7838064509027,"position":3,"created_at":"2025-07-16T09:49:18+08:00","updated_at":"2025-07-16T09:49:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560","variant_ids":[43528675197027]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827418210403,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f4289a7fe6e06b6b1258ecf54e005b0474cb2f3.webp?v=1752630560"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675295331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193369071715,"product_id":7838064509027,"position":6,"created_at":"2025-07-16T09:49:19+08:00","updated_at":"2025-07-16T09:49:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561","variant_ids":[43528675295331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827418964067,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/331794c35f3e0b3c8af0757630920a84b750954a.webp?v=1752630561"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43528675459171,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193370382435,"product_id":7838064509027,"position":10,"created_at":"2025-07-16T09:49:21+08:00","updated_at":"2025-07-16T09:49:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563","variant_ids":[43528675459171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827419979875,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6c4c075878234d0314677f912a02ef725841e3b9.webp?v=1752630563"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43528672051299,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-HK66","requires_shipping":true,"taxable":true,"featured_image":{"id":34193366188131,"product_id":7838064509027,"position":1,"created_at":"2025-07-16T09:49:16+08:00","updated_at":"2025-07-16T09:49:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558","variant_ids":[43528672051299]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX BOUNCE 棒棒獸 - 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-HK66","featured_media":{"alt":null,"id":25827417227363,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/816ec9853e105b6a027fa540dddc2fcc4ad1e812.webp?v=1752630558"}},"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: "停產" }