$product = {"id":7823710158947,"title":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black)","handle":"iphone-15-pro-max-solidx-xk19","description":null,"published_at":"2025-07-01T19:27:49+08:00","created_at":"2025-06-20T10:16:32+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nasa","device-iPhone 15 Pro Max","merge","reseller-nasa"],"price":125000,"price_min":125000,"price_max":125000,"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":43472263839843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480190316643,"product_id":7823710158947,"position":9,"created_at":"2026-08-04T18:42:25+08:00","updated_at":"2026-08-04T18:42:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147","variant_ids":[43472263839843]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129852-XK19","featured_media":{"alt":null,"id":27983509225571,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267346019,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480191529059,"product_id":7823710158947,"position":11,"created_at":"2026-08-04T18:42:28+08:00","updated_at":"2026-08-04T18:42:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150","variant_ids":[43472267346019]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129853-XK19","featured_media":{"alt":null,"id":27983510470755,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267444323,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480190873699,"product_id":7823710158947,"position":10,"created_at":"2026-08-04T18:42:27+08:00","updated_at":"2026-08-04T18:42:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149","variant_ids":[43472267444323]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298O8-XK19","featured_media":{"alt":null,"id":27983509815395,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267477091,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480189759587,"product_id":7823710158947,"position":8,"created_at":"2026-08-04T18:42:23+08:00","updated_at":"2026-08-04T18:42:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145","variant_ids":[43472267477091]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298Z7-XK19","featured_media":{"alt":null,"id":27983508668515,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-298-XK19.png?v=1750385795","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-XK19_974d655d-f9f2-4593-8e18-e694771ab40c.png?v=1750831803","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab.webp?v=1783997450","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9.webp?v=1783997451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593.webp?v=1783997451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8.webp?v=1783997452","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9.webp?v=1783997453","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9_6af894dd-49fa-41d2-be80-3c7313614dd3.webp?v=1785840151"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-298-XK19.png?v=1750385795","options":["color"],"media":[{"alt":null,"id":25720252334179,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-298-XK19.png?v=1750385795"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-298-XK19.png?v=1750385795","width":2000},{"alt":null,"id":25736265105507,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-XK19_974d655d-f9f2-4593-8e18-e694771ab40c.png?v=1750831803"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidX-52-295-XK19_974d655d-f9f2-4593-8e18-e694771ab40c.png?v=1750831803","width":2000},{"alt":null,"id":27759557279843,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab.webp?v=1783997450"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab.webp?v=1783997450","width":2000},{"alt":null,"id":27759557607523,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9.webp?v=1783997451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9.webp?v=1783997451","width":2000},{"alt":null,"id":27759557869667,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593.webp?v=1783997451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593.webp?v=1783997451","width":2000},{"alt":null,"id":27759558099043,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8.webp?v=1783997452"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8.webp?v=1783997452","width":2000},{"alt":null,"id":27759558262883,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9.webp?v=1783997453"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9.webp?v=1783997453","width":2000},{"alt":null,"id":27983508668515,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145","width":2000},{"alt":null,"id":27983509225571,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147","width":2000},{"alt":null,"id":27983509815395,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149","width":2000},{"alt":null,"id":27983510470755,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150","width":2000},{"alt":null,"id":27983511126115,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9_6af894dd-49fa-41d2-be80-3c7313614dd3.webp?v=1785840151"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b82b8b1d97c4730abf68e65c55d7e76ec5860de9_6af894dd-49fa-41d2-be80-3c7313614dd3.webp?v=1785840151","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43472263839843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480190316643,"product_id":7823710158947,"position":9,"created_at":"2026-08-04T18:42:25+08:00","updated_at":"2026-08-04T18:42:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147","variant_ids":[43472263839843]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129852-XK19","featured_media":{"alt":null,"id":27983509225571,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267346019,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480191529059,"product_id":7823710158947,"position":11,"created_at":"2026-08-04T18:42:28+08:00","updated_at":"2026-08-04T18:42:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150","variant_ids":[43472267346019]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129853-XK19","featured_media":{"alt":null,"id":27983510470755,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e72e9d26ebf8646fd3afffacba174edd6191593_95fe18e5-ede7-4bf4-a83a-5988e216c29a.webp?v=1785840150"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267444323,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480190873699,"product_id":7823710158947,"position":10,"created_at":"2026-08-04T18:42:27+08:00","updated_at":"2026-08-04T18:42:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149","variant_ids":[43472267444323]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298O8-XK19","featured_media":{"alt":null,"id":27983509815395,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f7cef1746a6f47a77942512260c32832193cd9f8_f37131fb-802f-4fb6-a94b-e0247fefbbcd.webp?v=1785840149"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43472267477091,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480189759587,"product_id":7823710158947,"position":8,"created_at":"2026-08-04T18:42:23+08:00","updated_at":"2026-08-04T18:42:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145","variant_ids":[43472267477091]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298Z7-XK19","featured_media":{"alt":null,"id":27983508668515,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef84f71fef6adf13b63e84b9a1b1f0658e8dcab_302d0065-8c67-4cbe-bfc7-7c383e4ef077.webp?v=1785840145"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43472263839843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XK19","requires_shipping":true,"taxable":true,"featured_image":{"id":36480190316643,"product_id":7823710158947,"position":9,"created_at":"2026-08-04T18:42:25+08:00","updated_at":"2026-08-04T18:42:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147","variant_ids":[43472263839843]},"available":true,"name":"iPhone 15 Pro Max SolidX 太空 太空宇航員 (Black) - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129852-XK19","featured_media":{"alt":null,"id":27983509225571,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b70f2adc6dc77a1ab4d47150f2601f31c83d7b9_960ae212-e699-4a2b-bb78-5bd4e34c8fab.webp?v=1785840147"}},"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: "停產"
}