$product = {"id":7922036277347,"title":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓","handle":"iphone-12-pro-mod-nx-toc03","description":null,"published_at":"2025-11-14T08:09:04+08:00","created_at":"2025-11-13T10:36:25+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-tocorocomugi","device-iPhone 12 Pro","merge","reseller-tocorocomugi"],"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":43834994196579,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794425679971,"product_id":7922036277347,"position":2,"created_at":"2025-11-13T10:36:27+08:00","updated_at":"2025-11-13T10:36:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389","variant_ids":[43834994196579]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359844536419,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998030435,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794428432483,"product_id":7922036277347,"position":11,"created_at":"2025-11-13T10:36:35+08:00","updated_at":"2025-11-13T10:36:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397","variant_ids":[43834998030435]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359847288931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998063203,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794428104803,"product_id":7922036277347,"position":10,"created_at":"2025-11-13T10:36:34+08:00","updated_at":"2025-11-13T10:36:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396","variant_ids":[43834998063203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359846961251,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998161507,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794427678819,"product_id":7922036277347,"position":8,"created_at":"2025-11-13T10:36:32+08:00","updated_at":"2025-11-13T10:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394","variant_ids":[43834998161507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359846535267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998194275,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794425843811,"product_id":7922036277347,"position":3,"created_at":"2025-11-13T10:36:28+08:00","updated_at":"2025-11-13T10:36:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390","variant_ids":[43834998194275]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359844700259,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e34672521832c4442935196ade4005291ae8742.webp?v=1763001388","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c41e24182cec5ae042fbc99e1bd25e7fb530994.webp?v=1763001390","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfb4478e4c7fb214cd379f5154a08bd9488082fe.webp?v=1763001392","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa73bb6e7420701b52ff28c39afab75cb9d765c5.webp?v=1763001393","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/512c2e225a7d043e288911bdb8154ad874aa9f91.webp?v=1763001394","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/019abc9c4074973989df2b1fcb6a7d0af6dc03bf.webp?v=1763001395","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e34672521832c4442935196ade4005291ae8742.webp?v=1763001388","options":["color"],"media":[{"alt":null,"id":26359844372579,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e34672521832c4442935196ade4005291ae8742.webp?v=1763001388"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e34672521832c4442935196ade4005291ae8742.webp?v=1763001388","width":2000},{"alt":null,"id":26359844536419,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389","width":2000},{"alt":null,"id":26359844700259,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390","width":2000},{"alt":null,"id":26359844962403,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c41e24182cec5ae042fbc99e1bd25e7fb530994.webp?v=1763001390"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c41e24182cec5ae042fbc99e1bd25e7fb530994.webp?v=1763001390","width":2000},{"alt":null,"id":26359845847139,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfb4478e4c7fb214cd379f5154a08bd9488082fe.webp?v=1763001392"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bfb4478e4c7fb214cd379f5154a08bd9488082fe.webp?v=1763001392","width":2000},{"alt":null,"id":26359846109283,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa73bb6e7420701b52ff28c39afab75cb9d765c5.webp?v=1763001393"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa73bb6e7420701b52ff28c39afab75cb9d765c5.webp?v=1763001393","width":2000},{"alt":null,"id":26359846371427,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/512c2e225a7d043e288911bdb8154ad874aa9f91.webp?v=1763001394"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/512c2e225a7d043e288911bdb8154ad874aa9f91.webp?v=1763001394","width":2000},{"alt":null,"id":26359846535267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394","width":2000},{"alt":null,"id":26359846764643,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/019abc9c4074973989df2b1fcb6a7d0af6dc03bf.webp?v=1763001395"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/019abc9c4074973989df2b1fcb6a7d0af6dc03bf.webp?v=1763001395","width":2000},{"alt":null,"id":26359846961251,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396","width":2000},{"alt":null,"id":26359847288931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43834994196579,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794425679971,"product_id":7922036277347,"position":2,"created_at":"2025-11-13T10:36:27+08:00","updated_at":"2025-11-13T10:36:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389","variant_ids":[43834994196579]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359844536419,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998030435,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794428432483,"product_id":7922036277347,"position":11,"created_at":"2025-11-13T10:36:35+08:00","updated_at":"2025-11-13T10:36:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397","variant_ids":[43834998030435]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359847288931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b436e84a6a4848429431791aa565f9061732cf75.webp?v=1763001397"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998063203,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794428104803,"product_id":7922036277347,"position":10,"created_at":"2025-11-13T10:36:34+08:00","updated_at":"2025-11-13T10:36:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396","variant_ids":[43834998063203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359846961251,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/351ea6d71cdae5c60ee14199c5c654e660635fce.webp?v=1763001396"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998161507,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794427678819,"product_id":7922036277347,"position":8,"created_at":"2025-11-13T10:36:32+08:00","updated_at":"2025-11-13T10:36:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394","variant_ids":[43834998161507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359846535267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb99bff3b54e626944e87193fc882b67ec7938ce.webp?v=1763001394"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43834998194275,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794425843811,"product_id":7922036277347,"position":3,"created_at":"2025-11-13T10:36:28+08:00","updated_at":"2025-11-13T10:36:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390","variant_ids":[43834998194275]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359844700259,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/505c9cae3ff78c469c06fcf4c47908574db70add.webp?v=1763001390"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43834994196579,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-TOC03","requires_shipping":true,"taxable":true,"featured_image":{"id":34794425679971,"product_id":7922036277347,"position":2,"created_at":"2025-11-13T10:36:27+08:00","updated_at":"2025-11-13T10:36:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389","variant_ids":[43834994196579]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX TOCOROCOMUGI 三貫壽司貓 - 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-TOC03","featured_media":{"alt":null,"id":26359844536419,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d8b86ae53be20d5f33cd6595a1c75224e51ed4b.webp?v=1763001389"}},"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: "停產"
}