$product = {"id":7937842151523,"title":"iPhone 12 \/ 12 Pro Mod NX 進擊的巨人 Attack on Titan 超大型巨人","handle":"iphone-12-pro-mod-nx-xu09","description":null,"published_at":"2025-12-12T10:49:15+08:00","created_at":"2025-12-11T15:40:05+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":43884104056931,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932762706019,"product_id":7937842151523,"position":7,"created_at":"2025-12-11T15:40:13+08:00","updated_at":"2025-12-11T15:40:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815","variant_ids":[43884104056931]},"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-XU09","featured_media":{"alt":null,"id":26495134498915,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108218467,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932764016739,"product_id":7937842151523,"position":11,"created_at":"2025-12-11T15:40:16+08:00","updated_at":"2025-12-11T15:40:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818","variant_ids":[43884108218467]},"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-XU09","featured_media":{"alt":null,"id":26495135973475,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108382307,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932761722979,"product_id":7937842151523,"position":3,"created_at":"2025-12-11T15:40:11+08:00","updated_at":"2025-12-11T15:40:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812","variant_ids":[43884108382307]},"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-XU09","featured_media":{"alt":null,"id":26495133515875,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108447843,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932763852899,"product_id":7937842151523,"position":10,"created_at":"2025-12-11T15:40:16+08:00","updated_at":"2025-12-11T15:40:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818","variant_ids":[43884108447843]},"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-XU09","featured_media":{"alt":null,"id":26495135776867,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108480611,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932761296995,"product_id":7937842151523,"position":1,"created_at":"2025-12-11T15:40:10+08:00","updated_at":"2025-12-11T15:40:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812","variant_ids":[43884108480611]},"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-XU09","featured_media":{"alt":null,"id":26495133089891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99bcc8cb1f8600f35fbfeee4035dc1c7ab2fade7.webp?v=1765438812","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81d3ff9727fd1cf48bc4a22fb86ddee392c9bdbf.webp?v=1765438813","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fde7705b2a2c57efde426990cad91960b05f2fe.webp?v=1765438814","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6390678a12ee59774c56e3be5dc4f58a4a831007.webp?v=1765438814","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fbf77dedaa1f417447a23fe95dc87cf1d1f52adc.webp?v=1765438815","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/736cce5543c0c2b9b088ee996b59119faa1c9f75.webp?v=1765438817","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812","options":["color"],"media":[{"alt":null,"id":26495133089891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812","width":2000},{"alt":null,"id":26495133286499,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99bcc8cb1f8600f35fbfeee4035dc1c7ab2fade7.webp?v=1765438812"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99bcc8cb1f8600f35fbfeee4035dc1c7ab2fade7.webp?v=1765438812","width":2000},{"alt":null,"id":26495133515875,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812","width":2000},{"alt":null,"id":26495133712483,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81d3ff9727fd1cf48bc4a22fb86ddee392c9bdbf.webp?v=1765438813"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81d3ff9727fd1cf48bc4a22fb86ddee392c9bdbf.webp?v=1765438813","width":2000},{"alt":null,"id":26495133941859,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fde7705b2a2c57efde426990cad91960b05f2fe.webp?v=1765438814"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fde7705b2a2c57efde426990cad91960b05f2fe.webp?v=1765438814","width":2000},{"alt":null,"id":26495134236771,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6390678a12ee59774c56e3be5dc4f58a4a831007.webp?v=1765438814"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6390678a12ee59774c56e3be5dc4f58a4a831007.webp?v=1765438814","width":2000},{"alt":null,"id":26495134498915,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815","width":2000},{"alt":null,"id":26495134859363,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fbf77dedaa1f417447a23fe95dc87cf1d1f52adc.webp?v=1765438815"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fbf77dedaa1f417447a23fe95dc87cf1d1f52adc.webp?v=1765438815","width":2000},{"alt":null,"id":26495135285347,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/736cce5543c0c2b9b088ee996b59119faa1c9f75.webp?v=1765438817"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/736cce5543c0c2b9b088ee996b59119faa1c9f75.webp?v=1765438817","width":2000},{"alt":null,"id":26495135776867,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818","width":2000},{"alt":null,"id":26495135973475,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43884104056931,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932762706019,"product_id":7937842151523,"position":7,"created_at":"2025-12-11T15:40:13+08:00","updated_at":"2025-12-11T15:40:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815","variant_ids":[43884104056931]},"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-XU09","featured_media":{"alt":null,"id":26495134498915,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108218467,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932764016739,"product_id":7937842151523,"position":11,"created_at":"2025-12-11T15:40:16+08:00","updated_at":"2025-12-11T15:40:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818","variant_ids":[43884108218467]},"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-XU09","featured_media":{"alt":null,"id":26495135973475,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60437274083901653997280c2923e9088937e505.webp?v=1765438818"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108382307,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932761722979,"product_id":7937842151523,"position":3,"created_at":"2025-12-11T15:40:11+08:00","updated_at":"2025-12-11T15:40:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812","variant_ids":[43884108382307]},"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-XU09","featured_media":{"alt":null,"id":26495133515875,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/200f09e4875f7b60ecaac5290df773c6ef7e162d.webp?v=1765438812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108447843,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932763852899,"product_id":7937842151523,"position":10,"created_at":"2025-12-11T15:40:16+08:00","updated_at":"2025-12-11T15:40:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818","variant_ids":[43884108447843]},"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-XU09","featured_media":{"alt":null,"id":26495135776867,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eafb3537d958510aebc8048abe56db1af3f8854b.webp?v=1765438818"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884108480611,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932761296995,"product_id":7937842151523,"position":1,"created_at":"2025-12-11T15:40:10+08:00","updated_at":"2025-12-11T15:40:12+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812","variant_ids":[43884108480611]},"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-XU09","featured_media":{"alt":null,"id":26495133089891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a645ba701c6366fc74492eca779b523d0b84cbd.webp?v=1765438812"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43884104056931,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932762706019,"product_id":7937842151523,"position":7,"created_at":"2025-12-11T15:40:13+08:00","updated_at":"2025-12-11T15:40:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815","variant_ids":[43884104056931]},"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-XU09","featured_media":{"alt":null,"id":26495134498915,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef2f27cc90194c1f9963a8fbb38bc64f67f1acdc.webp?v=1765438815"}},"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: "停產"
}