$product = {"id":7921122934883,"title":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡","handle":"iphone-13-pro-max-mod-nx-hd72","description":null,"published_at":"2025-11-13T09:50:41+08:00","created_at":"2025-11-11T09:39:04+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-incrediville","device-iPhone 13 Pro Max","merge","reseller-incrediville"],"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":43830850748515,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0123224-HD72","requires_shipping":true,"taxable":true,"featured_image":{"id":34793910403171,"product_id":7921122934883,"position":15,"created_at":"2025-11-13T09:27:15+08:00","updated_at":"2025-11-13T09:27:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237","variant_ids":[43830850748515]},"available":true,"name":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0123224-HD72","featured_media":{"alt":null,"id":26359330537571,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43830850977891,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01232J5-HD72","requires_shipping":true,"taxable":true,"featured_image":{"id":34793911255139,"product_id":7921122934883,"position":18,"created_at":"2025-11-13T09:27:17+08:00","updated_at":"2025-11-13T09:27:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239","variant_ids":[43830850977891]},"available":true,"name":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡 - 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":"NPB01232J5-HD72","featured_media":{"alt":null,"id":26359331389539,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2.webp?v=1762825152","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47.webp?v=1762825153","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818.webp?v=1762825153","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc.webp?v=1762825154","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54.webp?v=1762825155","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254.webp?v=1762825156","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887.webp?v=1762825157","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23.webp?v=1762825157","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84.webp?v=1762825157","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47_f9460eaf-3585-4340-91ac-d4a6101dc05c.webp?v=1762997233","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887_58476915-757f-4adb-9785-247847f146dd.webp?v=1762997234","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc_fe6b6574-4521-4694-b602-cc57f32fecf1.webp?v=1762997235","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23_539c1b17-92bc-4c2e-8a41-a66e78bd32d4.webp?v=1762997236","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254_e11b2511-a90f-4482-86bc-e3cadded5436.webp?v=1762997236","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54_a4cede87-d359-41b8-8ac8-c0e101e2aa9e.webp?v=1762997238","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818_e71b9116-55b1-47fe-b366-a9a680928ba3.webp?v=1762997239","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2.webp?v=1762825152","options":["color"],"media":[{"alt":null,"id":26351481782371,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2.webp?v=1762825152"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2.webp?v=1762825152","width":2000},{"alt":null,"id":26351482044515,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47.webp?v=1762825153"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47.webp?v=1762825153","width":2000},{"alt":null,"id":26351482372195,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818.webp?v=1762825153"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818.webp?v=1762825153","width":2000},{"alt":null,"id":26351482699875,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc.webp?v=1762825154"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc.webp?v=1762825154","width":2000},{"alt":null,"id":26351483027555,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54.webp?v=1762825155"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54.webp?v=1762825155","width":2000},{"alt":null,"id":26351483256931,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254.webp?v=1762825156"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254.webp?v=1762825156","width":2000},{"alt":null,"id":26351483420771,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887.webp?v=1762825157"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887.webp?v=1762825157","width":2000},{"alt":null,"id":26351483584611,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23.webp?v=1762825157"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23.webp?v=1762825157","width":2000},{"alt":null,"id":26351483781219,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84.webp?v=1762825157"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84.webp?v=1762825157","width":2000},{"alt":null,"id":26359329521763,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47_f9460eaf-3585-4340-91ac-d4a6101dc05c.webp?v=1762997233"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e58d3ff0c5da9c43acc2160e70009f9f0dd9e47_f9460eaf-3585-4340-91ac-d4a6101dc05c.webp?v=1762997233","width":2000},{"alt":null,"id":26359329816675,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887_58476915-757f-4adb-9785-247847f146dd.webp?v=1762997234"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cfdd8f4b8675405e7b7f4176e27b3bc01c7a887_58476915-757f-4adb-9785-247847f146dd.webp?v=1762997234","width":2000},{"alt":null,"id":26359329980515,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc_fe6b6574-4521-4694-b602-cc57f32fecf1.webp?v=1762997235"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9054653eb3b5a7279473681f4d6d72ad2fbeeddc_fe6b6574-4521-4694-b602-cc57f32fecf1.webp?v=1762997235","width":2000},{"alt":null,"id":26359330177123,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23_539c1b17-92bc-4c2e-8a41-a66e78bd32d4.webp?v=1762997236"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1de022f8a4a43a737eedbc02d7e322e7f9670a23_539c1b17-92bc-4c2e-8a41-a66e78bd32d4.webp?v=1762997236","width":2000},{"alt":null,"id":26359330340963,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254_e11b2511-a90f-4482-86bc-e3cadded5436.webp?v=1762997236"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ab7e08cea7ef66cd6d708124f900b6e072f5254_e11b2511-a90f-4482-86bc-e3cadded5436.webp?v=1762997236","width":2000},{"alt":null,"id":26359330537571,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237","width":2000},{"alt":null,"id":26359330766947,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54_a4cede87-d359-41b8-8ac8-c0e101e2aa9e.webp?v=1762997238"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b65b9ae16ca27a66426895c7b749e8bb3d1dcd54_a4cede87-d359-41b8-8ac8-c0e101e2aa9e.webp?v=1762997238","width":2000},{"alt":null,"id":26359331061859,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818_e71b9116-55b1-47fe-b366-a9a680928ba3.webp?v=1762997239"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec091d846026f564f2a653ee4d18741d80e99818_e71b9116-55b1-47fe-b366-a9a680928ba3.webp?v=1762997239","width":2000},{"alt":null,"id":26359331389539,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43830850748515,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0123224-HD72","requires_shipping":true,"taxable":true,"featured_image":{"id":34793910403171,"product_id":7921122934883,"position":15,"created_at":"2025-11-13T09:27:15+08:00","updated_at":"2025-11-13T09:27:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237","variant_ids":[43830850748515]},"available":true,"name":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0123224-HD72","featured_media":{"alt":null,"id":26359330537571,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43830850977891,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01232J5-HD72","requires_shipping":true,"taxable":true,"featured_image":{"id":34793911255139,"product_id":7921122934883,"position":18,"created_at":"2025-11-13T09:27:17+08:00","updated_at":"2025-11-13T09:27:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239","variant_ids":[43830850977891]},"available":true,"name":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡 - 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":"NPB01232J5-HD72","featured_media":{"alt":null,"id":26359331389539,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/07a9fd50dfa6daa155cd074159e1191236623b84_cb23f955-5fcf-4960-a250-8db540198003.webp?v=1762997239"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43830850748515,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0123224-HD72","requires_shipping":true,"taxable":true,"featured_image":{"id":34793910403171,"product_id":7921122934883,"position":15,"created_at":"2025-11-13T09:27:15+08:00","updated_at":"2025-11-13T09:27:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237","variant_ids":[43830850748515]},"available":true,"name":"iPhone 13 Pro Max Mod NX Incrediville 怪奇事物所 公園裡的格爾尼卡 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0123224-HD72","featured_media":{"alt":null,"id":26359330537571,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63d5e63ecf3f7bf9a0f8165fac396aa4caec66f2_2504eec0-6220-4679-95ca-16f694c1c37f.webp?v=1762997237"}},"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: "停產"
}