$product = {"id":7873259765859,"title":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest","handle":"iphone-12-pro-mod-nx-printable-kei10","description":null,"published_at":"2025-09-01T10:58:11+08:00","created_at":"2025-09-01T09:37:20+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":43658510237795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409865150563,"product_id":7873259765859,"position":11,"created_at":"2025-09-01T09:37:32+08:00","updated_at":"2025-09-01T09:37:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654","variant_ids":[43658510237795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982180130915,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510270563,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409862955107,"product_id":7873259765859,"position":2,"created_at":"2025-09-01T09:37:25+08:00","updated_at":"2025-09-01T09:37:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647","variant_ids":[43658510270563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982177935459,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510368867,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409864855651,"product_id":7873259765859,"position":9,"created_at":"2025-09-01T09:37:31+08:00","updated_at":"2025-09-01T09:37:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653","variant_ids":[43658510368867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982179836003,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510401635,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409864593507,"product_id":7873259765859,"position":8,"created_at":"2025-09-01T09:37:30+08:00","updated_at":"2025-09-01T09:37:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652","variant_ids":[43658510401635]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982179573859,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510499939,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409863250019,"product_id":7873259765859,"position":3,"created_at":"2025-09-01T09:37:26+08:00","updated_at":"2025-09-01T09:37:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648","variant_ids":[43658510499939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982178230371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/665a569a6d99dc0e9643e29cda1589d18b6a6dee.webp?v=1756690646","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a7f7a242d590f2800b898423b4585953f505de32.webp?v=1756690648","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f5fd0b49be8463f529e15081d240e00f3d144f.webp?v=1756690649","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88ff288179391a740fad2b02f992492922a0dead.webp?v=1756690650","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a5a70f4062b51b83cc0cd35b993ec024fa9fa7b.webp?v=1756690650","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb6987c109d37b2256b687d234e31955f982c185.webp?v=1756690653","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/665a569a6d99dc0e9643e29cda1589d18b6a6dee.webp?v=1756690646","options":["color"],"media":[{"alt":null,"id":25982177738851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/665a569a6d99dc0e9643e29cda1589d18b6a6dee.webp?v=1756690646"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/665a569a6d99dc0e9643e29cda1589d18b6a6dee.webp?v=1756690646","width":2000},{"alt":null,"id":25982177935459,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647","width":2000},{"alt":null,"id":25982178230371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648","width":2000},{"alt":null,"id":25982178426979,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a7f7a242d590f2800b898423b4585953f505de32.webp?v=1756690648"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a7f7a242d590f2800b898423b4585953f505de32.webp?v=1756690648","width":2000},{"alt":null,"id":25982178590819,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f5fd0b49be8463f529e15081d240e00f3d144f.webp?v=1756690649"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9f5fd0b49be8463f529e15081d240e00f3d144f.webp?v=1756690649","width":2000},{"alt":null,"id":25982178918499,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88ff288179391a740fad2b02f992492922a0dead.webp?v=1756690650"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88ff288179391a740fad2b02f992492922a0dead.webp?v=1756690650","width":2000},{"alt":null,"id":25982179082339,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a5a70f4062b51b83cc0cd35b993ec024fa9fa7b.webp?v=1756690650"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1a5a70f4062b51b83cc0cd35b993ec024fa9fa7b.webp?v=1756690650","width":2000},{"alt":null,"id":25982179573859,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652","width":2000},{"alt":null,"id":25982179836003,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653","width":2000},{"alt":null,"id":25982179999843,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb6987c109d37b2256b687d234e31955f982c185.webp?v=1756690653"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cb6987c109d37b2256b687d234e31955f982c185.webp?v=1756690653","width":2000},{"alt":null,"id":25982180130915,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43658510237795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409865150563,"product_id":7873259765859,"position":11,"created_at":"2025-09-01T09:37:32+08:00","updated_at":"2025-09-01T09:37:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654","variant_ids":[43658510237795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982180130915,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510270563,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409862955107,"product_id":7873259765859,"position":2,"created_at":"2025-09-01T09:37:25+08:00","updated_at":"2025-09-01T09:37:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647","variant_ids":[43658510270563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982177935459,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/913036d01c4226535e82b123bd8c7b7fadf0ebdb.webp?v=1756690647"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510368867,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409864855651,"product_id":7873259765859,"position":9,"created_at":"2025-09-01T09:37:31+08:00","updated_at":"2025-09-01T09:37:33+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653","variant_ids":[43658510368867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982179836003,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c96f8d10fb5d8b90b3f7d3220310ac414cc3150.webp?v=1756690653"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510401635,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409864593507,"product_id":7873259765859,"position":8,"created_at":"2025-09-01T09:37:30+08:00","updated_at":"2025-09-01T09:37:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652","variant_ids":[43658510401635]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982179573859,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ef9f04148dc763249d4aee5e023fc7a249dd170.webp?v=1756690652"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43658510499939,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409863250019,"product_id":7873259765859,"position":3,"created_at":"2025-09-01T09:37:26+08:00","updated_at":"2025-09-01T09:37:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648","variant_ids":[43658510499939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982178230371,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e51fc9c723f8e9b9a46c13731124677646c73239.webp?v=1756690648"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43658510237795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-KEI10","requires_shipping":true,"taxable":true,"featured_image":{"id":34409865150563,"product_id":7873259765859,"position":11,"created_at":"2025-09-01T09:37:32+08:00","updated_at":"2025-09-01T09:37:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654","variant_ids":[43658510237795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Keigo Rest - 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-KEI10","featured_media":{"alt":null,"id":25982180130915,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c323c4052887adad531fdbbcb2be3b5b4595920.webp?v=1756690654"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null;
$brand_handle = null;
$type = "";
var sellingStatus
// 只有設計款(SKU 含 '-')才需要合圖
if ($isMerge && $defaultVariant.sku.includes('-')) {
$(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: "停產"
}