$product = {"id":7911215661155,"title":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹","handle":"iphone-12-pro-mod-nx-printable-pos09","description":null,"published_at":"2025-11-05T10:44:18+08:00","created_at":"2025-11-04T10:38:47+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-posterlad","device-iPhone 12 Pro","merge","reseller-posterlad"],"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":43812011376739,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729139765347,"product_id":7911215661155,"position":2,"created_at":"2025-11-04T10:38:49+08:00","updated_at":"2025-11-04T10:38:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931","variant_ids":[43812011376739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297008193635,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015767651,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729141010531,"product_id":7911215661155,"position":7,"created_at":"2025-11-04T10:38:54+08:00","updated_at":"2025-11-04T10:38:56+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936","variant_ids":[43812015767651]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297009406051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015800419,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729139568739,"product_id":7911215661155,"position":1,"created_at":"2025-11-04T10:38:49+08:00","updated_at":"2025-11-04T10:38:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930","variant_ids":[43812015800419]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297007997027,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015833187,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729140027491,"product_id":7911215661155,"position":3,"created_at":"2025-11-04T10:38:50+08:00","updated_at":"2025-11-04T10:38:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932","variant_ids":[43812015833187]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297008423011,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812016029795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729141796963,"product_id":7911215661155,"position":10,"created_at":"2025-11-04T10:38:56+08:00","updated_at":"2025-11-04T10:38:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938","variant_ids":[43812016029795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297010192483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/270961fded7a2ae65697c19c6641be295b273e3c.webp?v=1762223933","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8208d0e4da3b5ec2d3f1c6a0b2ce64c3ab63089f.webp?v=1762223934","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff7b84e0869081480d85a1bc44dd18bcd3ef09be.webp?v=1762223935","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b25a7819b3e183d6c47d55f89584263bd8d6fd47.webp?v=1762223936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ecfc0ba2cfc0edadd679b308bf06d2b8478a228.webp?v=1762223937","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5dd0da0c0caf02c868f4a83406ce708d4682ce7.webp?v=1762223940"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930","options":["color"],"media":[{"alt":null,"id":26297007997027,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930","width":2000},{"alt":null,"id":26297008193635,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931","width":2000},{"alt":null,"id":26297008423011,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932","width":2000},{"alt":null,"id":26297008619619,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/270961fded7a2ae65697c19c6641be295b273e3c.webp?v=1762223933"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/270961fded7a2ae65697c19c6641be295b273e3c.webp?v=1762223933","width":2000},{"alt":null,"id":26297008914531,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8208d0e4da3b5ec2d3f1c6a0b2ce64c3ab63089f.webp?v=1762223934"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8208d0e4da3b5ec2d3f1c6a0b2ce64c3ab63089f.webp?v=1762223934","width":2000},{"alt":null,"id":26297009242211,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff7b84e0869081480d85a1bc44dd18bcd3ef09be.webp?v=1762223935"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff7b84e0869081480d85a1bc44dd18bcd3ef09be.webp?v=1762223935","width":2000},{"alt":null,"id":26297009406051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936","width":2000},{"alt":null,"id":26297009635427,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b25a7819b3e183d6c47d55f89584263bd8d6fd47.webp?v=1762223936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b25a7819b3e183d6c47d55f89584263bd8d6fd47.webp?v=1762223936","width":2000},{"alt":null,"id":26297009864803,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ecfc0ba2cfc0edadd679b308bf06d2b8478a228.webp?v=1762223937"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ecfc0ba2cfc0edadd679b308bf06d2b8478a228.webp?v=1762223937","width":2000},{"alt":null,"id":26297010192483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938","width":2000},{"alt":null,"id":26297010651235,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5dd0da0c0caf02c868f4a83406ce708d4682ce7.webp?v=1762223940"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5dd0da0c0caf02c868f4a83406ce708d4682ce7.webp?v=1762223940","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43812011376739,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729139765347,"product_id":7911215661155,"position":2,"created_at":"2025-11-04T10:38:49+08:00","updated_at":"2025-11-04T10:38:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931","variant_ids":[43812011376739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297008193635,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015767651,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729141010531,"product_id":7911215661155,"position":7,"created_at":"2025-11-04T10:38:54+08:00","updated_at":"2025-11-04T10:38:56+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936","variant_ids":[43812015767651]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297009406051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d695e8e2f93984258bb5f8d63f505743031c520.webp?v=1762223936"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015800419,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729139568739,"product_id":7911215661155,"position":1,"created_at":"2025-11-04T10:38:49+08:00","updated_at":"2025-11-04T10:38:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930","variant_ids":[43812015800419]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297007997027,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b1cbdbc98610096fa212bdc9de747801620c87f.webp?v=1762223930"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812015833187,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729140027491,"product_id":7911215661155,"position":3,"created_at":"2025-11-04T10:38:50+08:00","updated_at":"2025-11-04T10:38:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932","variant_ids":[43812015833187]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297008423011,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1028c5ba4e7286d213a5501902c11d7ef470b6ed.webp?v=1762223932"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812016029795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729141796963,"product_id":7911215661155,"position":10,"created_at":"2025-11-04T10:38:56+08:00","updated_at":"2025-11-04T10:38:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938","variant_ids":[43812016029795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297010192483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cafc923608d8bd7925742f44996ca8449b81e626.webp?v=1762223938"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43812011376739,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729139765347,"product_id":7911215661155,"position":2,"created_at":"2025-11-04T10:38:49+08:00","updated_at":"2025-11-04T10:38:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931","variant_ids":[43812011376739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad 樹 - 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-POS09","featured_media":{"alt":null,"id":26297008193635,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e31a7baf465174f0d1c4e75436e6ff93d8fb6f62.webp?v=1762223931"}},"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: "停產"
}