$product = {"id":7937865875555,"title":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 城牆保衛戰","handle":"iphone-12-pro-mod-nx-xu02","description":null,"published_at":"2025-12-12T10:44:14+08:00","created_at":"2025-12-11T15:45:49+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":43884200165475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932863238243,"product_id":7937865875555,"position":3,"created_at":"2025-12-11T15:45:53+08:00","updated_at":"2025-12-11T15:45:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155","variant_ids":[43884200165475]},"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-XU02","featured_media":{"alt":null,"id":26495234998371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203114595,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932865990755,"product_id":7937865875555,"position":6,"created_at":"2025-12-11T15:45:57+08:00","updated_at":"2025-12-11T15:45:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159","variant_ids":[43884203114595]},"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-XU02","featured_media":{"alt":null,"id":26495235850339,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203278435,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932866449507,"product_id":7937865875555,"position":8,"created_at":"2025-12-11T15:45:58+08:00","updated_at":"2025-12-11T15:46:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160","variant_ids":[43884203278435]},"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-XU02","featured_media":{"alt":null,"id":26495236309091,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203343971,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932867006563,"product_id":7937865875555,"position":11,"created_at":"2025-12-11T15:45:59+08:00","updated_at":"2025-12-11T15:46:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161","variant_ids":[43884203343971]},"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-XU02","featured_media":{"alt":null,"id":26495236866147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203376739,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932862976099,"product_id":7937865875555,"position":1,"created_at":"2025-12-11T15:45:52+08:00","updated_at":"2025-12-11T15:45:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154","variant_ids":[43884203376739]},"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-XU02","featured_media":{"alt":null,"id":26495234736227,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4d6fc26b18859b3020685a9caaabd994cc81bad.webp?v=1765439155","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf89b7292e233a8b08162eeda683488b35920b6.webp?v=1765439158","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8afe2c2d0a003f5102d1e6d2c4002cea29323680.webp?v=1765439159","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6cca3fc0aa2b3c5b1d2cf96138eaddee57c9632b.webp?v=1765439160","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8c3addec26b1313fd1b40a9f7c8efeaf912f6c.webp?v=1765439161","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61fdab539ee0d6b0572090a148e545c57b0c2742.webp?v=1765439161","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154","options":["color"],"media":[{"alt":null,"id":26495234736227,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154","width":2000},{"alt":null,"id":26495234834531,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4d6fc26b18859b3020685a9caaabd994cc81bad.webp?v=1765439155"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4d6fc26b18859b3020685a9caaabd994cc81bad.webp?v=1765439155","width":2000},{"alt":null,"id":26495234998371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155","width":2000},{"alt":null,"id":26495235293283,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf89b7292e233a8b08162eeda683488b35920b6.webp?v=1765439158"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bf89b7292e233a8b08162eeda683488b35920b6.webp?v=1765439158","width":2000},{"alt":null,"id":26495235588195,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8afe2c2d0a003f5102d1e6d2c4002cea29323680.webp?v=1765439159"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8afe2c2d0a003f5102d1e6d2c4002cea29323680.webp?v=1765439159","width":2000},{"alt":null,"id":26495235850339,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159","width":2000},{"alt":null,"id":26495236112483,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6cca3fc0aa2b3c5b1d2cf96138eaddee57c9632b.webp?v=1765439160"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6cca3fc0aa2b3c5b1d2cf96138eaddee57c9632b.webp?v=1765439160","width":2000},{"alt":null,"id":26495236309091,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160","width":2000},{"alt":null,"id":26495236538467,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8c3addec26b1313fd1b40a9f7c8efeaf912f6c.webp?v=1765439161"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c8c3addec26b1313fd1b40a9f7c8efeaf912f6c.webp?v=1765439161","width":2000},{"alt":null,"id":26495236735075,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61fdab539ee0d6b0572090a148e545c57b0c2742.webp?v=1765439161"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61fdab539ee0d6b0572090a148e545c57b0c2742.webp?v=1765439161","width":2000},{"alt":null,"id":26495236866147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43884200165475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932863238243,"product_id":7937865875555,"position":3,"created_at":"2025-12-11T15:45:53+08:00","updated_at":"2025-12-11T15:45:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155","variant_ids":[43884200165475]},"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-XU02","featured_media":{"alt":null,"id":26495234998371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203114595,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932865990755,"product_id":7937865875555,"position":6,"created_at":"2025-12-11T15:45:57+08:00","updated_at":"2025-12-11T15:45:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159","variant_ids":[43884203114595]},"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-XU02","featured_media":{"alt":null,"id":26495235850339,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0706bf4af5b91bc747a12e0f63e618e903372d12.webp?v=1765439159"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203278435,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932866449507,"product_id":7937865875555,"position":8,"created_at":"2025-12-11T15:45:58+08:00","updated_at":"2025-12-11T15:46:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160","variant_ids":[43884203278435]},"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-XU02","featured_media":{"alt":null,"id":26495236309091,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0537b3ce9ff768db2742d0153eceb788dbb86b01.webp?v=1765439160"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203343971,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932867006563,"product_id":7937865875555,"position":11,"created_at":"2025-12-11T15:45:59+08:00","updated_at":"2025-12-11T15:46:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161","variant_ids":[43884203343971]},"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-XU02","featured_media":{"alt":null,"id":26495236866147,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f577acc0738b98f64c1d912d977fc21af46dfe5f.webp?v=1765439161"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884203376739,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932862976099,"product_id":7937865875555,"position":1,"created_at":"2025-12-11T15:45:52+08:00","updated_at":"2025-12-11T15:45:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154","variant_ids":[43884203376739]},"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-XU02","featured_media":{"alt":null,"id":26495234736227,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e028daa76c062e6ea7feaa199607609358c74c4.webp?v=1765439154"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43884200165475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU02","requires_shipping":true,"taxable":true,"featured_image":{"id":34932863238243,"product_id":7937865875555,"position":3,"created_at":"2025-12-11T15:45:53+08:00","updated_at":"2025-12-11T15:45:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155","variant_ids":[43884200165475]},"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-XU02","featured_media":{"alt":null,"id":26495234998371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6153ead3986daee2c99311e1af95dd79f3cc51f7.webp?v=1765439155"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null
var sellingStatus
if ($bumper) {
$(document).ready(function() {
var productImg = $product.images[0]
var bumperVariants = $bumper.variants;
var bumperColors = new Object();
var currentVariant = '';
var productType = '';
bumperVariants.forEach(variant => {
bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src;
});
if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') {
mergeImages(
[productImg, bumperColors[currentVariant]],
{ crossOrigin: 'anonymous' }
).then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
} else {
mergeImages(
[bumperColors[currentVariant], productImg],
{ crossOrigin: 'anonymous' }
).then(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: "停產"
}