$product = {"id":7873229619299,"title":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker","handle":"iphone-12-pro-mod-nx-printable-kei03","description":null,"published_at":"2025-09-01T11:10:38+08:00","created_at":"2025-09-01T09:29:34+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-keigo","device-iPhone 12 Pro","merge","reseller-keigo"],"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":43658399711331,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754886243,"product_id":7873229619299,"position":7,"created_at":"2025-09-01T09:29:43+08:00","updated_at":"2025-09-01T09:29:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185","variant_ids":[43658399711331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982070063203,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399744099,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754624099,"product_id":7873229619299,"position":6,"created_at":"2025-09-01T09:29:42+08:00","updated_at":"2025-09-01T09:29:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184","variant_ids":[43658399744099]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069801059,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399842403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409755574371,"product_id":7873229619299,"position":11,"created_at":"2025-09-01T09:29:46+08:00","updated_at":"2025-09-01T09:29:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188","variant_ids":[43658399842403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982070751331,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399875171,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409753935971,"product_id":7873229619299,"position":1,"created_at":"2025-09-01T09:29:39+08:00","updated_at":"2025-09-01T09:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181","variant_ids":[43658399875171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069080163,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399973475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754034275,"product_id":7873229619299,"position":2,"created_at":"2025-09-01T09:29:39+08:00","updated_at":"2025-09-01T09:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181","variant_ids":[43658399973475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069211235,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f31979794f3d09a32f414cce822240ee61a8c84.webp?v=1756690182","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1474b4d1225b89c118b4a9e8a97e10e94973dd2b.webp?v=1756690183","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/efc09b3a229f4f45de898e72a877eb9cb6b30553.webp?v=1756690184","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dad24d00bfea389b904159b8e125636317b6391f.webp?v=1756690185","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a47318c8dbd6cb8883439eff22fa3e2d912e1b6.webp?v=1756690186","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/247d77c1213f63d6c766a159be9749b33737e3c5.webp?v=1756690187","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181","options":["color"],"media":[{"alt":null,"id":25982069080163,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181","width":2000},{"alt":null,"id":25982069211235,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181","width":2000},{"alt":null,"id":25982069309539,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f31979794f3d09a32f414cce822240ee61a8c84.webp?v=1756690182"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7f31979794f3d09a32f414cce822240ee61a8c84.webp?v=1756690182","width":2000},{"alt":null,"id":25982069440611,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1474b4d1225b89c118b4a9e8a97e10e94973dd2b.webp?v=1756690183"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1474b4d1225b89c118b4a9e8a97e10e94973dd2b.webp?v=1756690183","width":2000},{"alt":null,"id":25982069571683,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/efc09b3a229f4f45de898e72a877eb9cb6b30553.webp?v=1756690184"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/efc09b3a229f4f45de898e72a877eb9cb6b30553.webp?v=1756690184","width":2000},{"alt":null,"id":25982069801059,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184","width":2000},{"alt":null,"id":25982070063203,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185","width":2000},{"alt":null,"id":25982070227043,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dad24d00bfea389b904159b8e125636317b6391f.webp?v=1756690185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dad24d00bfea389b904159b8e125636317b6391f.webp?v=1756690185","width":2000},{"alt":null,"id":25982070390883,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a47318c8dbd6cb8883439eff22fa3e2d912e1b6.webp?v=1756690186"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a47318c8dbd6cb8883439eff22fa3e2d912e1b6.webp?v=1756690186","width":2000},{"alt":null,"id":25982070489187,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/247d77c1213f63d6c766a159be9749b33737e3c5.webp?v=1756690187"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/247d77c1213f63d6c766a159be9749b33737e3c5.webp?v=1756690187","width":2000},{"alt":null,"id":25982070751331,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43658399711331,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754886243,"product_id":7873229619299,"position":7,"created_at":"2025-09-01T09:29:43+08:00","updated_at":"2025-09-01T09:29:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185","variant_ids":[43658399711331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982070063203,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399744099,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754624099,"product_id":7873229619299,"position":6,"created_at":"2025-09-01T09:29:42+08:00","updated_at":"2025-09-01T09:29:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184","variant_ids":[43658399744099]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069801059,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6292f5d6193cd9d10a3a0cad4a0aaea4cfb3082d.webp?v=1756690184"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399842403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409755574371,"product_id":7873229619299,"position":11,"created_at":"2025-09-01T09:29:46+08:00","updated_at":"2025-09-01T09:29:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188","variant_ids":[43658399842403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982070751331,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0321e840f761b691cac4f69aa917ea354a375a9b.webp?v=1756690188"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399875171,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409753935971,"product_id":7873229619299,"position":1,"created_at":"2025-09-01T09:29:39+08:00","updated_at":"2025-09-01T09:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181","variant_ids":[43658399875171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069080163,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6198d5debc3960f77553a13b4f59346130dc80.webp?v=1756690181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658399973475,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754034275,"product_id":7873229619299,"position":2,"created_at":"2025-09-01T09:29:39+08:00","updated_at":"2025-09-01T09:29:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181","variant_ids":[43658399973475]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982069211235,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0b1cafd1a050d8644da59a5159e60a4efdc7cdc6.webp?v=1756690181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43658399711331,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI03","requires_shipping":true,"taxable":true,"featured_image":{"id":34409754886243,"product_id":7873229619299,"position":7,"created_at":"2025-09-01T09:29:43+08:00","updated_at":"2025-09-01T09:29:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185","variant_ids":[43658399711331]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Loudspeaker - 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-KEI03","featured_media":{"alt":null,"id":25982070063203,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bf8bf809029cd710e9338a5005db3e4d4b348d0.webp?v=1756690185"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null;
$type = "";
var sellingStatus
if ($isMerge) {
$(document).ready(function() {
var productImg = $product.images[0];
var bumperImg = window.getProductImageUrl($defaultVariant.sku.split('-')[0]);
var layers = ($type === 'mod-nx-backplate' || $type === 'mod-backplate')
? [productImg, bumperImg]
: [bumperImg, productImg];
window.mergeProductImages(layers).then(function (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: "停產"
}