$product = {"id":7937567228003,"title":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展","handle":"iphone-12-pro-mod-nx-cjy07","description":null,"published_at":"2025-12-12T09:48:31+08:00","created_at":"2025-12-11T09:49:14+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-jychoioioi","device-iPhone 12 Pro","merge","reseller-jychoioioi"],"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":43883002265699,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930887589987,"product_id":7937567228003,"position":6,"created_at":"2025-12-11T09:49:20+08:00","updated_at":"2025-12-11T09:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762","variant_ids":[43883002265699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493261971555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006001251,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930886574179,"product_id":7937567228003,"position":1,"created_at":"2025-12-11T09:49:17+08:00","updated_at":"2025-12-11T09:49:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759","variant_ids":[43883006001251]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493260988515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006034019,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930887786595,"product_id":7937567228003,"position":7,"created_at":"2025-12-11T09:49:20+08:00","updated_at":"2025-12-11T09:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762","variant_ids":[43883006034019]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493262168163,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006165091,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930886901859,"product_id":7937567228003,"position":2,"created_at":"2025-12-11T09:49:18+08:00","updated_at":"2025-12-11T09:49:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760","variant_ids":[43883006165091]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493261316195,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006197859,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930888343651,"product_id":7937567228003,"position":10,"created_at":"2025-12-11T09:49:22+08:00","updated_at":"2025-12-11T09:49:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764","variant_ids":[43883006197859]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493262856291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51358d3a1220fd4175346032829c1557ee6822ea.webp?v=1765417760","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de465f4a29dd979988ae5a5fae300f85bbe2e606.webp?v=1765417761","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6254f5a585dcebce4bdf296df81a8c8ebd8d0cce.webp?v=1765417761","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1f9f9705da98da72afd99e4ec7361795fc731c17.webp?v=1765417763","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377af766f46954436680174fd13f1f12d53a08c0.webp?v=1765417763","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6eee19cc82be68ab0b114380305d65d96ac9bbb0.webp?v=1765417764"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759","options":["color"],"media":[{"alt":null,"id":26493260988515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759","width":2000},{"alt":null,"id":26493261316195,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760","width":2000},{"alt":null,"id":26493261512803,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51358d3a1220fd4175346032829c1557ee6822ea.webp?v=1765417760"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51358d3a1220fd4175346032829c1557ee6822ea.webp?v=1765417760","width":2000},{"alt":null,"id":26493261643875,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de465f4a29dd979988ae5a5fae300f85bbe2e606.webp?v=1765417761"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de465f4a29dd979988ae5a5fae300f85bbe2e606.webp?v=1765417761","width":2000},{"alt":null,"id":26493261840483,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6254f5a585dcebce4bdf296df81a8c8ebd8d0cce.webp?v=1765417761"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6254f5a585dcebce4bdf296df81a8c8ebd8d0cce.webp?v=1765417761","width":2000},{"alt":null,"id":26493261971555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762","width":2000},{"alt":null,"id":26493262168163,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762","width":2000},{"alt":null,"id":26493262332003,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1f9f9705da98da72afd99e4ec7361795fc731c17.webp?v=1765417763"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1f9f9705da98da72afd99e4ec7361795fc731c17.webp?v=1765417763","width":2000},{"alt":null,"id":26493262692451,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377af766f46954436680174fd13f1f12d53a08c0.webp?v=1765417763"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/377af766f46954436680174fd13f1f12d53a08c0.webp?v=1765417763","width":2000},{"alt":null,"id":26493262856291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764","width":2000},{"alt":null,"id":26493262954595,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6eee19cc82be68ab0b114380305d65d96ac9bbb0.webp?v=1765417764"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6eee19cc82be68ab0b114380305d65d96ac9bbb0.webp?v=1765417764","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43883002265699,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930887589987,"product_id":7937567228003,"position":6,"created_at":"2025-12-11T09:49:20+08:00","updated_at":"2025-12-11T09:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762","variant_ids":[43883002265699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493261971555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006001251,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930886574179,"product_id":7937567228003,"position":1,"created_at":"2025-12-11T09:49:17+08:00","updated_at":"2025-12-11T09:49:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759","variant_ids":[43883006001251]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493260988515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/067daefc4ba3ed67aef8f516d88626d2abbff2f3.webp?v=1765417759"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006034019,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930887786595,"product_id":7937567228003,"position":7,"created_at":"2025-12-11T09:49:20+08:00","updated_at":"2025-12-11T09:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762","variant_ids":[43883006034019]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493262168163,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1baf015ffd0c2d871b684604e55703a5de308a1c.webp?v=1765417762"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006165091,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930886901859,"product_id":7937567228003,"position":2,"created_at":"2025-12-11T09:49:18+08:00","updated_at":"2025-12-11T09:49:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760","variant_ids":[43883006165091]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493261316195,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/48aaadb36749c160d9a7208dcd5001ba3bd30948.webp?v=1765417760"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883006197859,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930888343651,"product_id":7937567228003,"position":10,"created_at":"2025-12-11T09:49:22+08:00","updated_at":"2025-12-11T09:49:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764","variant_ids":[43883006197859]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493262856291,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3f5ce4ef9c8fb04d9772d02830375e37b507bad.webp?v=1765417764"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43883002265699,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CJY07","requires_shipping":true,"taxable":true,"featured_image":{"id":34930887589987,"product_id":7937567228003,"position":6,"created_at":"2025-12-11T09:49:20+08:00","updated_at":"2025-12-11T09:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762","variant_ids":[43883002265699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Jin Young Choi 一起伸展 - 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-CJY07","featured_media":{"alt":null,"id":26493261971555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d8323db2dec76817549a3ea6bafc1c6f2ba045d1.webp?v=1765417762"}},"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: "停產"
}