$product = {"id":7888618848355,"title":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT","handle":"iphone-12-pro-mod-nx-printable-dm04","description":null,"published_at":"2025-09-23T09:02:45+08:00","created_at":"2025-09-22T16:51:37+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-dumplingcat","device-iPhone 12 Pro","merge","reseller-dumplingcat"],"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":43743784763491,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515759759459,"product_id":7888618848355,"position":11,"created_at":"2025-09-22T16:51:45+08:00","updated_at":"2025-09-22T16:51:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107","variant_ids":[43743784763491]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086197297251,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788138595,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758776419,"product_id":7888618848355,"position":5,"created_at":"2025-09-22T16:51:42+08:00","updated_at":"2025-09-22T16:51:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104","variant_ids":[43743788138595]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196314211,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788171363,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515759005795,"product_id":7888618848355,"position":7,"created_at":"2025-09-22T16:51:43+08:00","updated_at":"2025-09-22T16:51:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105","variant_ids":[43743788171363]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196543587,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788236899,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758284899,"product_id":7888618848355,"position":2,"created_at":"2025-09-22T16:51:41+08:00","updated_at":"2025-09-22T16:51:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103","variant_ids":[43743788236899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086195822691,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788269667,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758645347,"product_id":7888618848355,"position":4,"created_at":"2025-09-22T16:51:42+08:00","updated_at":"2025-09-22T16:51:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104","variant_ids":[43743788269667]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196183139,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102eb4719e73326f871a4c57a1710d470612df53.webp?v=1758531102","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1c067a86d9ca10910b23659b71997bf34b23975.webp?v=1758531103","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ed62cac94d2219202e1452aa9757c0bf1275642.webp?v=1758531105","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa606ba60b13e22ba2cd576398b838307a7b3c31.webp?v=1758531106","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dbe0245f570500600ab867befed35db15d6f5285.webp?v=1758531106","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a4d018f5dbfe66f66461fa31c9d6477bf74dcdd.webp?v=1758531107","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102eb4719e73326f871a4c57a1710d470612df53.webp?v=1758531102","options":["color"],"media":[{"alt":null,"id":26086195691619,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102eb4719e73326f871a4c57a1710d470612df53.webp?v=1758531102"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/102eb4719e73326f871a4c57a1710d470612df53.webp?v=1758531102","width":2000},{"alt":null,"id":26086195822691,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103","width":2000},{"alt":null,"id":26086196019299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1c067a86d9ca10910b23659b71997bf34b23975.webp?v=1758531103"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1c067a86d9ca10910b23659b71997bf34b23975.webp?v=1758531103","width":2000},{"alt":null,"id":26086196183139,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104","width":2000},{"alt":null,"id":26086196314211,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104","width":2000},{"alt":null,"id":26086196412515,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ed62cac94d2219202e1452aa9757c0bf1275642.webp?v=1758531105"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ed62cac94d2219202e1452aa9757c0bf1275642.webp?v=1758531105","width":2000},{"alt":null,"id":26086196543587,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105","width":2000},{"alt":null,"id":26086196707427,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa606ba60b13e22ba2cd576398b838307a7b3c31.webp?v=1758531106"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa606ba60b13e22ba2cd576398b838307a7b3c31.webp?v=1758531106","width":2000},{"alt":null,"id":26086196838499,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dbe0245f570500600ab867befed35db15d6f5285.webp?v=1758531106"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dbe0245f570500600ab867befed35db15d6f5285.webp?v=1758531106","width":2000},{"alt":null,"id":26086197035107,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a4d018f5dbfe66f66461fa31c9d6477bf74dcdd.webp?v=1758531107"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5a4d018f5dbfe66f66461fa31c9d6477bf74dcdd.webp?v=1758531107","width":2000},{"alt":null,"id":26086197297251,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43743784763491,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515759759459,"product_id":7888618848355,"position":11,"created_at":"2025-09-22T16:51:45+08:00","updated_at":"2025-09-22T16:51:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107","variant_ids":[43743784763491]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086197297251,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788138595,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758776419,"product_id":7888618848355,"position":5,"created_at":"2025-09-22T16:51:42+08:00","updated_at":"2025-09-22T16:51:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104","variant_ids":[43743788138595]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196314211,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b378efe2057754a5dc33029325385f54b5de2596.webp?v=1758531104"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788171363,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515759005795,"product_id":7888618848355,"position":7,"created_at":"2025-09-22T16:51:43+08:00","updated_at":"2025-09-22T16:51:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105","variant_ids":[43743788171363]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196543587,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0164a063138b94bacd841a0d924704c5a531b789.webp?v=1758531105"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788236899,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758284899,"product_id":7888618848355,"position":2,"created_at":"2025-09-22T16:51:41+08:00","updated_at":"2025-09-22T16:51:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103","variant_ids":[43743788236899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086195822691,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/facba1f162408059f425d84ad5af845fba4e6f00.webp?v=1758531103"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43743788269667,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515758645347,"product_id":7888618848355,"position":4,"created_at":"2025-09-22T16:51:42+08:00","updated_at":"2025-09-22T16:51:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104","variant_ids":[43743788269667]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086196183139,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4fd32e9466bb625bb561d929fbb6309a354cfc45.webp?v=1758531104"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43743784763491,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-DM04","requires_shipping":true,"taxable":true,"featured_image":{"id":34515759759459,"product_id":7888618848355,"position":11,"created_at":"2025-09-22T16:51:45+08:00","updated_at":"2025-09-22T16:51:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107","variant_ids":[43743784763491]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 餃貓FAMILY 餃貓 LUCKY CAT - 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-DM04","featured_media":{"alt":null,"id":26086197297251,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58e58acf1076ef400c60274c4e75619cd150d208.webp?v=1758531107"}},"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: "停產"
}