$product = {"id":7892672577635,"title":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy","handle":"iphone-12-pro-mod-nx-printable-aar01","description":null,"published_at":"2025-10-03T09:42:20+08:00","created_at":"2025-10-02T10:07:27+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-aaronchang","device-iPhone 12 Pro","merge","reseller-aaronchang"],"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":43756717539427,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543774072931,"product_id":7892672577635,"position":11,"created_at":"2025-10-02T10:07:41+08:00","updated_at":"2025-10-02T10:07:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863","variant_ids":[43756717539427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528954979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720652387,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543774007395,"product_id":7892672577635,"position":10,"created_at":"2025-10-02T10:07:40+08:00","updated_at":"2025-10-02T10:07:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862","variant_ids":[43756720652387]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528889443,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720685155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543773810787,"product_id":7892672577635,"position":9,"created_at":"2025-10-02T10:07:39+08:00","updated_at":"2025-10-02T10:07:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862","variant_ids":[43756720685155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528692835,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720750691,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543772074083,"product_id":7892672577635,"position":1,"created_at":"2025-10-02T10:07:32+08:00","updated_at":"2025-10-02T10:07:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854","variant_ids":[43756720750691]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113526956131,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720881763,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543772827747,"product_id":7892672577635,"position":4,"created_at":"2025-10-02T10:07:34+08:00","updated_at":"2025-10-02T10:07:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856","variant_ids":[43756720881763]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113527709795,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/33ed357d06692812510aa5b0fadb334aaf988d38.webp?v=1759370855","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/596739eb8372b5f14b8dae27c745916ef79f3b2b.webp?v=1759370856","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5678fcaa4e68003826c0908d2825404eb9414035.webp?v=1759370857","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c1706332eb58a8159d8a442a78121ccc83de534.webp?v=1759370858","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87814be0254158499c192b296dbb431be68ba838.webp?v=1759370860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca501d07b0ed4fd4a7b39ce006d49fa3a1de1db.webp?v=1759370861","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854","options":["color"],"media":[{"alt":null,"id":26113526956131,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854","width":2000},{"alt":null,"id":26113527283811,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/33ed357d06692812510aa5b0fadb334aaf988d38.webp?v=1759370855"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/33ed357d06692812510aa5b0fadb334aaf988d38.webp?v=1759370855","width":2000},{"alt":null,"id":26113527545955,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/596739eb8372b5f14b8dae27c745916ef79f3b2b.webp?v=1759370856"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/596739eb8372b5f14b8dae27c745916ef79f3b2b.webp?v=1759370856","width":2000},{"alt":null,"id":26113527709795,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856","width":2000},{"alt":null,"id":26113527873635,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5678fcaa4e68003826c0908d2825404eb9414035.webp?v=1759370857"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5678fcaa4e68003826c0908d2825404eb9414035.webp?v=1759370857","width":2000},{"alt":null,"id":26113528070243,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c1706332eb58a8159d8a442a78121ccc83de534.webp?v=1759370858"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c1706332eb58a8159d8a442a78121ccc83de534.webp?v=1759370858","width":2000},{"alt":null,"id":26113528332387,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87814be0254158499c192b296dbb431be68ba838.webp?v=1759370860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/87814be0254158499c192b296dbb431be68ba838.webp?v=1759370860","width":2000},{"alt":null,"id":26113528561763,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca501d07b0ed4fd4a7b39ce006d49fa3a1de1db.webp?v=1759370861"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca501d07b0ed4fd4a7b39ce006d49fa3a1de1db.webp?v=1759370861","width":2000},{"alt":null,"id":26113528692835,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862","width":2000},{"alt":null,"id":26113528889443,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862","width":2000},{"alt":null,"id":26113528954979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43756717539427,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543774072931,"product_id":7892672577635,"position":11,"created_at":"2025-10-02T10:07:41+08:00","updated_at":"2025-10-02T10:07:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863","variant_ids":[43756717539427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528954979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720652387,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543774007395,"product_id":7892672577635,"position":10,"created_at":"2025-10-02T10:07:40+08:00","updated_at":"2025-10-02T10:07:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862","variant_ids":[43756720652387]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528889443,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a434699cdf12bf39329ffb839b57d430f63502a.webp?v=1759370862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720685155,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543773810787,"product_id":7892672577635,"position":9,"created_at":"2025-10-02T10:07:39+08:00","updated_at":"2025-10-02T10:07:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862","variant_ids":[43756720685155]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528692835,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63251ee46eafc7b7079bca903690e5b2127ef2cd.webp?v=1759370862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720750691,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543772074083,"product_id":7892672577635,"position":1,"created_at":"2025-10-02T10:07:32+08:00","updated_at":"2025-10-02T10:07:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854","variant_ids":[43756720750691]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113526956131,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ad04535fb34d81744aea146f392c85aa25a9962.webp?v=1759370854"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756720881763,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543772827747,"product_id":7892672577635,"position":4,"created_at":"2025-10-02T10:07:34+08:00","updated_at":"2025-10-02T10:07:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856","variant_ids":[43756720881763]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113527709795,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/079a9ef86304a85d5f0cb8e8727b47f3db51440a.webp?v=1759370856"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43756717539427,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR01","requires_shipping":true,"taxable":true,"featured_image":{"id":34543774072931,"product_id":7892672577635,"position":11,"created_at":"2025-10-02T10:07:41+08:00","updated_at":"2025-10-02T10:07:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863","variant_ids":[43756717539427]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Ivy Boy - 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-AAR01","featured_media":{"alt":null,"id":26113528954979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/287b7b1b507d15e46ccd73fc4b29be185b6115d2.webp?v=1759370863"}},"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: "停產"
}