$product = {"id":7911305412707,"title":"iPhone 12 \/ 12 Pro Mod NX PosterLad 郊區","handle":"iphone-12-pro-mod-nx-printable-pos08","description":null,"published_at":"2025-11-05T10:31:28+08:00","created_at":"2025-11-04T10:54:19+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":43812264509539,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378709603,"product_id":7911305412707,"position":8,"created_at":"2025-11-04T10:54:25+08:00","updated_at":"2025-11-04T10:54:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868","variant_ids":[43812264509539]},"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-POS08","featured_media":{"alt":null,"id":26297246285923,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267327587,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378971747,"product_id":7911305412707,"position":9,"created_at":"2025-11-04T10:54:26+08:00","updated_at":"2025-11-04T10:54:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868","variant_ids":[43812267327587]},"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-POS08","featured_media":{"alt":null,"id":26297246548067,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267360355,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729377497187,"product_id":7911305412707,"position":3,"created_at":"2025-11-04T10:54:22+08:00","updated_at":"2025-11-04T10:54:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864","variant_ids":[43812267360355]},"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-POS08","featured_media":{"alt":null,"id":26297245073507,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267393123,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729377726563,"product_id":7911305412707,"position":4,"created_at":"2025-11-04T10:54:23+08:00","updated_at":"2025-11-04T10:54:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865","variant_ids":[43812267393123]},"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-POS08","featured_media":{"alt":null,"id":26297245302883,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267589731,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378021475,"product_id":7911305412707,"position":5,"created_at":"2025-11-04T10:54:23+08:00","updated_at":"2025-11-04T10:54:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865","variant_ids":[43812267589731]},"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-POS08","featured_media":{"alt":null,"id":26297245597795,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2615d76eae6b1dd0383d664685485e94271db369.webp?v=1762224862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4eac556098b63a529b7ea252c552ba05f73be5ba.webp?v=1762224863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/05366fe24fc98d5b9a619400b1f2e4764fbb367d.webp?v=1762224866","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1019af1e67794118c215740020634077994dc2b8.webp?v=1762224867","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c26393a060a8d21d5da33109447affb273a459e4.webp?v=1762224869","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30ff77ede3622b85bbebc2955011d178b5043910.webp?v=1762224870"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2615d76eae6b1dd0383d664685485e94271db369.webp?v=1762224862","options":["color"],"media":[{"alt":null,"id":26297244614755,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2615d76eae6b1dd0383d664685485e94271db369.webp?v=1762224862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2615d76eae6b1dd0383d664685485e94271db369.webp?v=1762224862","width":2000},{"alt":null,"id":26297244811363,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4eac556098b63a529b7ea252c552ba05f73be5ba.webp?v=1762224863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4eac556098b63a529b7ea252c552ba05f73be5ba.webp?v=1762224863","width":2000},{"alt":null,"id":26297245073507,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864","width":2000},{"alt":null,"id":26297245302883,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865","width":2000},{"alt":null,"id":26297245597795,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865","width":2000},{"alt":null,"id":26297245859939,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/05366fe24fc98d5b9a619400b1f2e4764fbb367d.webp?v=1762224866"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/05366fe24fc98d5b9a619400b1f2e4764fbb367d.webp?v=1762224866","width":2000},{"alt":null,"id":26297246089315,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1019af1e67794118c215740020634077994dc2b8.webp?v=1762224867"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1019af1e67794118c215740020634077994dc2b8.webp?v=1762224867","width":2000},{"alt":null,"id":26297246285923,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868","width":2000},{"alt":null,"id":26297246548067,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868","width":2000},{"alt":null,"id":26297246777443,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c26393a060a8d21d5da33109447affb273a459e4.webp?v=1762224869"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c26393a060a8d21d5da33109447affb273a459e4.webp?v=1762224869","width":2000},{"alt":null,"id":26297247039587,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30ff77ede3622b85bbebc2955011d178b5043910.webp?v=1762224870"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/30ff77ede3622b85bbebc2955011d178b5043910.webp?v=1762224870","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43812264509539,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378709603,"product_id":7911305412707,"position":8,"created_at":"2025-11-04T10:54:25+08:00","updated_at":"2025-11-04T10:54:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868","variant_ids":[43812264509539]},"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-POS08","featured_media":{"alt":null,"id":26297246285923,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267327587,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378971747,"product_id":7911305412707,"position":9,"created_at":"2025-11-04T10:54:26+08:00","updated_at":"2025-11-04T10:54:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868","variant_ids":[43812267327587]},"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-POS08","featured_media":{"alt":null,"id":26297246548067,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c04e372e505856b9e04ad10f3fbb0187b377dd3.webp?v=1762224868"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267360355,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729377497187,"product_id":7911305412707,"position":3,"created_at":"2025-11-04T10:54:22+08:00","updated_at":"2025-11-04T10:54:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864","variant_ids":[43812267360355]},"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-POS08","featured_media":{"alt":null,"id":26297245073507,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fed60f5f673e84a08433c2ba2ba667a6cbe31671.webp?v=1762224864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267393123,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729377726563,"product_id":7911305412707,"position":4,"created_at":"2025-11-04T10:54:23+08:00","updated_at":"2025-11-04T10:54:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865","variant_ids":[43812267393123]},"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-POS08","featured_media":{"alt":null,"id":26297245302883,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8da02a110edfd48c6becff329114c8a0a4dc499a.webp?v=1762224865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812267589731,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378021475,"product_id":7911305412707,"position":5,"created_at":"2025-11-04T10:54:23+08:00","updated_at":"2025-11-04T10:54:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865","variant_ids":[43812267589731]},"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-POS08","featured_media":{"alt":null,"id":26297245597795,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/99c2158f32fde959f914d9088d8efb9355d6a441.webp?v=1762224865"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43812264509539,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-POS08","requires_shipping":true,"taxable":true,"featured_image":{"id":34729378709603,"product_id":7911305412707,"position":8,"created_at":"2025-11-04T10:54:25+08:00","updated_at":"2025-11-04T10:54:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868","variant_ids":[43812264509539]},"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-POS08","featured_media":{"alt":null,"id":26297246285923,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e82684abaaacfd1ef03a6fedfee5b4c65f5756ae.webp?v=1762224868"}},"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: "停產"
}