$product = {"id":7911276183651,"title":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial","handle":"iphone-12-pro-mod-nx-printable-pos01","description":null,"published_at":"2025-11-05T10:35:30+08:00","created_at":"2025-11-04T10:49:11+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":43812176855139,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729296592995,"product_id":7911276183651,"position":5,"created_at":"2025-11-04T10:49:20+08:00","updated_at":"2025-11-04T10:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562","variant_ids":[43812176855139]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297164726371,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181639267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729297903715,"product_id":7911276183651,"position":9,"created_at":"2025-11-04T10:49:24+08:00","updated_at":"2025-11-04T10:49:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566","variant_ids":[43812181639267]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297166004323,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181672035,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729296986211,"product_id":7911276183651,"position":6,"created_at":"2025-11-04T10:49:21+08:00","updated_at":"2025-11-04T10:49:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563","variant_ids":[43812181672035]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297165086819,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181704803,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729295478883,"product_id":7911276183651,"position":1,"created_at":"2025-11-04T10:49:16+08:00","updated_at":"2025-11-04T10:49:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558","variant_ids":[43812181704803]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297163513955,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181901411,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729297641571,"product_id":7911276183651,"position":8,"created_at":"2025-11-04T10:49:23+08:00","updated_at":"2025-11-04T10:49:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565","variant_ids":[43812181901411]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297165774947,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d15d698870e2af895266de56565bdefe0b93adca.webp?v=1762224559","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a8f0d41f1dbe2890921e7886e3ce3ed6b2d379c.webp?v=1762224560","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5dd007adc6c21efd5b0552539b3125cc152cbd3a.webp?v=1762224561","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02099f8db1fe03b93c45a03f1cdcb6a253a574ca.webp?v=1762224564","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6f1f9617b3f059d96cc11e705b2a6f414a03a68.webp?v=1762224567","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6af4d6a1d5922787d73d9006fb4b5d02b9292c9.webp?v=1762224568"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558","options":["color"],"media":[{"alt":null,"id":26297163513955,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558","width":2000},{"alt":null,"id":26297163776099,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d15d698870e2af895266de56565bdefe0b93adca.webp?v=1762224559"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d15d698870e2af895266de56565bdefe0b93adca.webp?v=1762224559","width":2000},{"alt":null,"id":26297164038243,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a8f0d41f1dbe2890921e7886e3ce3ed6b2d379c.webp?v=1762224560"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a8f0d41f1dbe2890921e7886e3ce3ed6b2d379c.webp?v=1762224560","width":2000},{"alt":null,"id":26297164464227,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5dd007adc6c21efd5b0552539b3125cc152cbd3a.webp?v=1762224561"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5dd007adc6c21efd5b0552539b3125cc152cbd3a.webp?v=1762224561","width":2000},{"alt":null,"id":26297164726371,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562","width":2000},{"alt":null,"id":26297165086819,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563","width":2000},{"alt":null,"id":26297165447267,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02099f8db1fe03b93c45a03f1cdcb6a253a574ca.webp?v=1762224564"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02099f8db1fe03b93c45a03f1cdcb6a253a574ca.webp?v=1762224564","width":2000},{"alt":null,"id":26297165774947,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565","width":2000},{"alt":null,"id":26297166004323,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566","width":2000},{"alt":null,"id":26297166332003,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6f1f9617b3f059d96cc11e705b2a6f414a03a68.webp?v=1762224567"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6f1f9617b3f059d96cc11e705b2a6f414a03a68.webp?v=1762224567","width":2000},{"alt":null,"id":26297166757987,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6af4d6a1d5922787d73d9006fb4b5d02b9292c9.webp?v=1762224568"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b6af4d6a1d5922787d73d9006fb4b5d02b9292c9.webp?v=1762224568","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43812176855139,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729296592995,"product_id":7911276183651,"position":5,"created_at":"2025-11-04T10:49:20+08:00","updated_at":"2025-11-04T10:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562","variant_ids":[43812176855139]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297164726371,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181639267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729297903715,"product_id":7911276183651,"position":9,"created_at":"2025-11-04T10:49:24+08:00","updated_at":"2025-11-04T10:49:26+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566","variant_ids":[43812181639267]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297166004323,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b1bc3d2999f3b79038075010482d232b279125a.webp?v=1762224566"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181672035,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729296986211,"product_id":7911276183651,"position":6,"created_at":"2025-11-04T10:49:21+08:00","updated_at":"2025-11-04T10:49:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563","variant_ids":[43812181672035]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297165086819,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c0dbc9e2bab37d302606bd07584d93fc365db17d.webp?v=1762224563"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181704803,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729295478883,"product_id":7911276183651,"position":1,"created_at":"2025-11-04T10:49:16+08:00","updated_at":"2025-11-04T10:49:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558","variant_ids":[43812181704803]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297163513955,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bbf42acfeeb0b72729cbd3b06aa12f0dca2e0.webp?v=1762224558"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812181901411,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729297641571,"product_id":7911276183651,"position":8,"created_at":"2025-11-04T10:49:23+08:00","updated_at":"2025-11-04T10:49:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565","variant_ids":[43812181901411]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297165774947,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6919a8e3322da297f1173a742e3ca76c23f45d21.webp?v=1762224565"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43812176855139,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS01","requires_shipping":true,"taxable":true,"featured_image":{"id":34729296592995,"product_id":7911276183651,"position":5,"created_at":"2025-11-04T10:49:20+08:00","updated_at":"2025-11-04T10:49:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562","variant_ids":[43812176855139]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX PosterLad Arial - 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-POS01","featured_media":{"alt":null,"id":26297164726371,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6206cf102c77321e2bfae236da4e0e0919d20a8.webp?v=1762224562"}},"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: "停產"
}