$product = {"id":7893890400355,"title":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語","handle":"iphone-12-pro-mod-nx-printable-chu01","description":null,"published_at":"2025-10-09T09:18:38+08:00","created_at":"2025-10-07T10:37:48+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-chubbynida","device-iPhone 12 Pro","merge","reseller-chubbynida"],"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":43763668287587,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402523747,"product_id":7893890400355,"position":4,"created_at":"2025-10-07T10:37:51+08:00","updated_at":"2025-10-07T10:37:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673","variant_ids":[43763668287587]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050156131,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671171171,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402654819,"product_id":7893890400355,"position":5,"created_at":"2025-10-07T10:37:52+08:00","updated_at":"2025-10-07T10:37:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674","variant_ids":[43763671171171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050287203,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671236707,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402753123,"product_id":7893890400355,"position":6,"created_at":"2025-10-07T10:37:53+08:00","updated_at":"2025-10-07T10:37:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675","variant_ids":[43763671236707]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050385507,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671302243,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553401933923,"product_id":7893890400355,"position":1,"created_at":"2025-10-07T10:37:49+08:00","updated_at":"2025-10-07T10:37:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672","variant_ids":[43763671302243]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123049566307,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671335011,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553403015267,"product_id":7893890400355,"position":8,"created_at":"2025-10-07T10:37:56+08:00","updated_at":"2025-10-07T10:37:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678","variant_ids":[43763671335011]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050647651,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d8ee6141bede40c6f4f37794bf160bdb395af74.webp?v=1759804672","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e5196945827aff9b8ca9296c6d92764bfa2c198d.webp?v=1759804673","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/346beb24953bbaa3738b77ae1522e09316988f7d.webp?v=1759804676","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126c4d118b3415bfe37a3b2fe2990acbf050e160.webp?v=1759804679","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62806375f62aa5ec8be4e4690ed6557ed1619890.webp?v=1759804679","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d17c560e4093c7680186c21887b99c973ea0a454.webp?v=1759804680"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672","options":["color"],"media":[{"alt":null,"id":26123049566307,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672","width":2000},{"alt":null,"id":26123049828451,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d8ee6141bede40c6f4f37794bf160bdb395af74.webp?v=1759804672"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d8ee6141bede40c6f4f37794bf160bdb395af74.webp?v=1759804672","width":2000},{"alt":null,"id":26123050090595,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e5196945827aff9b8ca9296c6d92764bfa2c198d.webp?v=1759804673"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e5196945827aff9b8ca9296c6d92764bfa2c198d.webp?v=1759804673","width":2000},{"alt":null,"id":26123050156131,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673","width":2000},{"alt":null,"id":26123050287203,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674","width":2000},{"alt":null,"id":26123050385507,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675","width":2000},{"alt":null,"id":26123050516579,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/346beb24953bbaa3738b77ae1522e09316988f7d.webp?v=1759804676"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/346beb24953bbaa3738b77ae1522e09316988f7d.webp?v=1759804676","width":2000},{"alt":null,"id":26123050647651,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678","width":2000},{"alt":null,"id":26123050844259,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126c4d118b3415bfe37a3b2fe2990acbf050e160.webp?v=1759804679"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126c4d118b3415bfe37a3b2fe2990acbf050e160.webp?v=1759804679","width":2000},{"alt":null,"id":26123051040867,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62806375f62aa5ec8be4e4690ed6557ed1619890.webp?v=1759804679"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62806375f62aa5ec8be4e4690ed6557ed1619890.webp?v=1759804679","width":2000},{"alt":null,"id":26123051401315,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d17c560e4093c7680186c21887b99c973ea0a454.webp?v=1759804680"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d17c560e4093c7680186c21887b99c973ea0a454.webp?v=1759804680","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43763668287587,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402523747,"product_id":7893890400355,"position":4,"created_at":"2025-10-07T10:37:51+08:00","updated_at":"2025-10-07T10:37:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673","variant_ids":[43763668287587]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050156131,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671171171,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402654819,"product_id":7893890400355,"position":5,"created_at":"2025-10-07T10:37:52+08:00","updated_at":"2025-10-07T10:37:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674","variant_ids":[43763671171171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050287203,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b297a72fbfe7786aa9d10f51b67a267e024a4db.webp?v=1759804674"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671236707,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402753123,"product_id":7893890400355,"position":6,"created_at":"2025-10-07T10:37:53+08:00","updated_at":"2025-10-07T10:37:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675","variant_ids":[43763671236707]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050385507,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/35ee0e76abfe93a7131c77898a61eb642c31b7db.webp?v=1759804675"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671302243,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553401933923,"product_id":7893890400355,"position":1,"created_at":"2025-10-07T10:37:49+08:00","updated_at":"2025-10-07T10:37:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672","variant_ids":[43763671302243]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123049566307,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe77e10007a9ae99046e86c601dd62f00dd4ac87.webp?v=1759804672"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763671335011,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553403015267,"product_id":7893890400355,"position":8,"created_at":"2025-10-07T10:37:56+08:00","updated_at":"2025-10-07T10:37:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678","variant_ids":[43763671335011]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050647651,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b6a68b3ec45173f6bafaace1b52279162c0619d.webp?v=1759804678"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43763668287587,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34553402523747,"product_id":7893890400355,"position":4,"created_at":"2025-10-07T10:37:51+08:00","updated_at":"2025-10-07T10:37:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673","variant_ids":[43763668287587]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 紫野花語 - 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-CHU01","featured_media":{"alt":null,"id":26123050156131,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/44c2971f41761a471b44d128d0ba57ec8dc75af5.webp?v=1759804673"}},"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: "停產"
}