$product = {"id":7888396910691,"title":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界","handle":"iphone-12-pro-mod-nx-printable-iq05","description":null,"published_at":"2025-09-23T09:21:32+08:00","created_at":"2025-09-22T15:19:33+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-kingjun","device-iPhone 12 Pro","merge","reseller-kingjun"],"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":43742952849507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247975011,"product_id":7888396910691,"position":4,"created_at":"2025-09-22T15:19:39+08:00","updated_at":"2025-09-22T15:19:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581","variant_ids":[43742952849507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690493539,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957469795,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514249318499,"product_id":7888396910691,"position":11,"created_at":"2025-09-22T15:19:43+08:00","updated_at":"2025-09-22T15:19:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585","variant_ids":[43742957469795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084691837027,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957600867,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247385187,"product_id":7888396910691,"position":1,"created_at":"2025-09-22T15:19:37+08:00","updated_at":"2025-09-22T15:19:39+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579","variant_ids":[43742957600867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084689903715,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957699171,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514248269923,"product_id":7888396910691,"position":6,"created_at":"2025-09-22T15:19:40+08:00","updated_at":"2025-09-22T15:19:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582","variant_ids":[43742957699171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690788451,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957731939,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247680099,"product_id":7888396910691,"position":2,"created_at":"2025-09-22T15:19:38+08:00","updated_at":"2025-09-22T15:19:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580","variant_ids":[43742957731939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690198627,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b4c0d89bebcde84ec4b6e25f04117cabbacf0897.webp?v=1758525581","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36ec25d591b34a4e4483fc7bf0152cdaaa7e858b.webp?v=1758525581","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/630f2a27b2a9c3c01241f70c0e06a7761811ab55.webp?v=1758525583","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80c9aec795f59d5469ddf2a41bf214443106b844.webp?v=1758525584","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/378b67991b80aceb6df4fbc8510c877953175061.webp?v=1758525584","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c55ca8d0b056be2fad5f2fc40032b4e3f89a98c9.webp?v=1758525584","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579","options":["color"],"media":[{"alt":null,"id":26084689903715,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579","width":2000},{"alt":null,"id":26084690198627,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580","width":2000},{"alt":null,"id":26084690362467,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b4c0d89bebcde84ec4b6e25f04117cabbacf0897.webp?v=1758525581"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b4c0d89bebcde84ec4b6e25f04117cabbacf0897.webp?v=1758525581","width":2000},{"alt":null,"id":26084690493539,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581","width":2000},{"alt":null,"id":26084690690147,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36ec25d591b34a4e4483fc7bf0152cdaaa7e858b.webp?v=1758525581"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36ec25d591b34a4e4483fc7bf0152cdaaa7e858b.webp?v=1758525581","width":2000},{"alt":null,"id":26084690788451,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582","width":2000},{"alt":null,"id":26084691050595,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/630f2a27b2a9c3c01241f70c0e06a7761811ab55.webp?v=1758525583"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/630f2a27b2a9c3c01241f70c0e06a7761811ab55.webp?v=1758525583","width":2000},{"alt":null,"id":26084691214435,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80c9aec795f59d5469ddf2a41bf214443106b844.webp?v=1758525584"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80c9aec795f59d5469ddf2a41bf214443106b844.webp?v=1758525584","width":2000},{"alt":null,"id":26084691411043,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/378b67991b80aceb6df4fbc8510c877953175061.webp?v=1758525584"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/378b67991b80aceb6df4fbc8510c877953175061.webp?v=1758525584","width":2000},{"alt":null,"id":26084691640419,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c55ca8d0b056be2fad5f2fc40032b4e3f89a98c9.webp?v=1758525584"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c55ca8d0b056be2fad5f2fc40032b4e3f89a98c9.webp?v=1758525584","width":2000},{"alt":null,"id":26084691837027,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43742952849507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247975011,"product_id":7888396910691,"position":4,"created_at":"2025-09-22T15:19:39+08:00","updated_at":"2025-09-22T15:19:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581","variant_ids":[43742952849507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690493539,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957469795,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514249318499,"product_id":7888396910691,"position":11,"created_at":"2025-09-22T15:19:43+08:00","updated_at":"2025-09-22T15:19:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585","variant_ids":[43742957469795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084691837027,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bf6beaad9afb303d1b8a8ce57bc135db23da6e8.webp?v=1758525585"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957600867,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247385187,"product_id":7888396910691,"position":1,"created_at":"2025-09-22T15:19:37+08:00","updated_at":"2025-09-22T15:19:39+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579","variant_ids":[43742957600867]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084689903715,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd93ce07f7a63870b9b8f72b2e26afefa83752bb.webp?v=1758525579"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957699171,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514248269923,"product_id":7888396910691,"position":6,"created_at":"2025-09-22T15:19:40+08:00","updated_at":"2025-09-22T15:19:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582","variant_ids":[43742957699171]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690788451,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/903e62f57de82f8c0b211d0a8c7a3731e3983dca.webp?v=1758525582"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43742957731939,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247680099,"product_id":7888396910691,"position":2,"created_at":"2025-09-22T15:19:38+08:00","updated_at":"2025-09-22T15:19:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580","variant_ids":[43742957731939]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690198627,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8661ed0035ce786e2830a4f7065f9bd1728594da.webp?v=1758525580"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43742952849507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-IQ05","requires_shipping":true,"taxable":true,"featured_image":{"id":34514247975011,"product_id":7888396910691,"position":4,"created_at":"2025-09-22T15:19:39+08:00","updated_at":"2025-09-22T15:19:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581","variant_ids":[43742952849507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX KINGJUN 外太空世界 - 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-IQ05","featured_media":{"alt":null,"id":26084690493539,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/701899a2d039bb81b1c4c967ee46eb31fb212147.webp?v=1758525581"}},"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: "停產"
}