$product = {"id":7848104853603,"title":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo","handle":"iphone-12-pro-mod-nx-bumper-crossover-design-fv61","description":null,"published_at":"2025-08-07T08:59:48+08:00","created_at":"2025-08-05T09:50:08+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-hijohnnn","device-iPhone 12 Pro","merge","reseller-hijohnnn"],"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":43563055972451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288120463459,"product_id":7848104853603,"position":5,"created_at":"2025-08-05T09:50:15+08:00","updated_at":"2025-08-05T09:50:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617","variant_ids":[43563055972451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010253923,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059347555,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288122560611,"product_id":7848104853603,"position":11,"created_at":"2025-08-05T09:50:18+08:00","updated_at":"2025-08-05T09:50:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621","variant_ids":[43563059347555]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889011236963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059413091,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288120823907,"product_id":7848104853603,"position":6,"created_at":"2025-08-05T09:50:15+08:00","updated_at":"2025-08-05T09:50:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618","variant_ids":[43563059413091]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010450531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059511395,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288121446499,"product_id":7848104853603,"position":8,"created_at":"2025-08-05T09:50:17+08:00","updated_at":"2025-08-05T09:50:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619","variant_ids":[43563059511395]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010712675,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059609699,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288122069091,"product_id":7848104853603,"position":10,"created_at":"2025-08-05T09:50:18+08:00","updated_at":"2025-08-05T09:50:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620","variant_ids":[43563059609699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889011105891,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40696e24d3bd7d57ab7a025e95b0fe210c731128.webp?v=1754358615","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa32f5866485a944ca3be75c5cc5846e40d118d6.webp?v=1754358616","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/93213b167453affc2e116676b6bcf57e6ccce0de.webp?v=1754358616","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d06d22b16304df8331d404364ace8f03ee69e79.webp?v=1754358617","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9d4cc8f31c8c19c5637bb3835010e73f09b9a79.webp?v=1754358619","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b37c3ed5049a5bfdfb11147d8ff61df2549aeb7e.webp?v=1754358619","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40696e24d3bd7d57ab7a025e95b0fe210c731128.webp?v=1754358615","options":["color"],"media":[{"alt":null,"id":25889009598563,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40696e24d3bd7d57ab7a025e95b0fe210c731128.webp?v=1754358615"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40696e24d3bd7d57ab7a025e95b0fe210c731128.webp?v=1754358615","width":2000},{"alt":null,"id":25889009795171,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa32f5866485a944ca3be75c5cc5846e40d118d6.webp?v=1754358616"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa32f5866485a944ca3be75c5cc5846e40d118d6.webp?v=1754358616","width":2000},{"alt":null,"id":25889009991779,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/93213b167453affc2e116676b6bcf57e6ccce0de.webp?v=1754358616"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/93213b167453affc2e116676b6bcf57e6ccce0de.webp?v=1754358616","width":2000},{"alt":null,"id":25889010155619,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d06d22b16304df8331d404364ace8f03ee69e79.webp?v=1754358617"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d06d22b16304df8331d404364ace8f03ee69e79.webp?v=1754358617","width":2000},{"alt":null,"id":25889010253923,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617","width":2000},{"alt":null,"id":25889010450531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618","width":2000},{"alt":null,"id":25889010581603,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9d4cc8f31c8c19c5637bb3835010e73f09b9a79.webp?v=1754358619"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9d4cc8f31c8c19c5637bb3835010e73f09b9a79.webp?v=1754358619","width":2000},{"alt":null,"id":25889010712675,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619","width":2000},{"alt":null,"id":25889010909283,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b37c3ed5049a5bfdfb11147d8ff61df2549aeb7e.webp?v=1754358619"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b37c3ed5049a5bfdfb11147d8ff61df2549aeb7e.webp?v=1754358619","width":2000},{"alt":null,"id":25889011105891,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620","width":2000},{"alt":null,"id":25889011236963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43563055972451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288120463459,"product_id":7848104853603,"position":5,"created_at":"2025-08-05T09:50:15+08:00","updated_at":"2025-08-05T09:50:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617","variant_ids":[43563055972451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010253923,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059347555,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288122560611,"product_id":7848104853603,"position":11,"created_at":"2025-08-05T09:50:18+08:00","updated_at":"2025-08-05T09:50:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621","variant_ids":[43563059347555]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889011236963,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a32cf08e0016fe84c636b3d6b3bdd9cbcfb94c1.webp?v=1754358621"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059413091,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288120823907,"product_id":7848104853603,"position":6,"created_at":"2025-08-05T09:50:15+08:00","updated_at":"2025-08-05T09:50:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618","variant_ids":[43563059413091]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010450531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b43205c6323c5a5b80ffc2c8a263dc0b020009c.webp?v=1754358618"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059511395,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288121446499,"product_id":7848104853603,"position":8,"created_at":"2025-08-05T09:50:17+08:00","updated_at":"2025-08-05T09:50:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619","variant_ids":[43563059511395]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010712675,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c08bc9161201baa419dc8a0d00006042ef32d9dc.webp?v=1754358619"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563059609699,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288122069091,"product_id":7848104853603,"position":10,"created_at":"2025-08-05T09:50:18+08:00","updated_at":"2025-08-05T09:50:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620","variant_ids":[43563059609699]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889011105891,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b73e172275a67a5f1108192733ae1486d4e776d.webp?v=1754358620"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43563055972451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-FV61","requires_shipping":true,"taxable":true,"featured_image":{"id":34288120463459,"product_id":7848104853603,"position":5,"created_at":"2025-08-05T09:50:15+08:00","updated_at":"2025-08-05T09:50:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617","variant_ids":[43563055972451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX 嗨小強 Peekaboo - 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-FV61","featured_media":{"alt":null,"id":25889010253923,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6f7aafa06b16ef6d7f4ebaf252a0747dc3448e8c.webp?v=1754358617"}},"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: "停產"
}