$product = {"id":7892618936419,"title":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy","handle":"iphone-12-pro-mod-nx-printable-aar09","description":null,"published_at":"2025-10-03T09:51:10+08:00","created_at":"2025-10-02T09:50:46+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-aaronchang","device-iPhone 12 Pro","merge","reseller-aaronchang"],"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":43756510642275,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543562096739,"product_id":7892618936419,"position":8,"created_at":"2025-10-02T09:51:02+08:00","updated_at":"2025-10-02T09:51:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864","variant_ids":[43756510642275]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316978787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513558627,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561506915,"product_id":7892618936419,"position":5,"created_at":"2025-10-02T09:50:57+08:00","updated_at":"2025-10-02T09:51:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860","variant_ids":[43756513558627]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316388963,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513591395,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561769059,"product_id":7892618936419,"position":7,"created_at":"2025-10-02T09:50:59+08:00","updated_at":"2025-10-02T09:51:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861","variant_ids":[43756513591395]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316683875,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513656931,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561015395,"product_id":7892618936419,"position":2,"created_at":"2025-10-02T09:50:55+08:00","updated_at":"2025-10-02T09:50:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858","variant_ids":[43756513656931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113315897443,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513788003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561310307,"product_id":7892618936419,"position":4,"created_at":"2025-10-02T09:50:57+08:00","updated_at":"2025-10-02T09:50:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859","variant_ids":[43756513788003]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316192355,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28393ae3f273f9b117a9e5052114c4df11e6624c.webp?v=1759369857","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c41681f973b4ac345a056dc2a5e33d318daa56cf.webp?v=1759369858","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/868868a66cebfa218c17686b55c9c954617011ee.webp?v=1759369860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c93c9e96a64df74ee629cece3238b98504b202.webp?v=1759369865","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1d1a593190a0cb93e4cfa9a840fd251fcf665de.webp?v=1759369867","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0466de4de9bfbd4519360dea6372b4495fcfacf4.webp?v=1759369868"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28393ae3f273f9b117a9e5052114c4df11e6624c.webp?v=1759369857","options":["color"],"media":[{"alt":null,"id":26113315733603,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28393ae3f273f9b117a9e5052114c4df11e6624c.webp?v=1759369857"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28393ae3f273f9b117a9e5052114c4df11e6624c.webp?v=1759369857","width":2000},{"alt":null,"id":26113315897443,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858","width":2000},{"alt":null,"id":26113316028515,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c41681f973b4ac345a056dc2a5e33d318daa56cf.webp?v=1759369858"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c41681f973b4ac345a056dc2a5e33d318daa56cf.webp?v=1759369858","width":2000},{"alt":null,"id":26113316192355,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859","width":2000},{"alt":null,"id":26113316388963,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860","width":2000},{"alt":null,"id":26113316520035,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/868868a66cebfa218c17686b55c9c954617011ee.webp?v=1759369860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/868868a66cebfa218c17686b55c9c954617011ee.webp?v=1759369860","width":2000},{"alt":null,"id":26113316683875,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861","width":2000},{"alt":null,"id":26113316978787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864","width":2000},{"alt":null,"id":26113317208163,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c93c9e96a64df74ee629cece3238b98504b202.webp?v=1759369865"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c93c9e96a64df74ee629cece3238b98504b202.webp?v=1759369865","width":2000},{"alt":null,"id":26113317372003,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1d1a593190a0cb93e4cfa9a840fd251fcf665de.webp?v=1759369867"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1d1a593190a0cb93e4cfa9a840fd251fcf665de.webp?v=1759369867","width":2000},{"alt":null,"id":26113317535843,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0466de4de9bfbd4519360dea6372b4495fcfacf4.webp?v=1759369868"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0466de4de9bfbd4519360dea6372b4495fcfacf4.webp?v=1759369868","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43756510642275,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543562096739,"product_id":7892618936419,"position":8,"created_at":"2025-10-02T09:51:02+08:00","updated_at":"2025-10-02T09:51:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864","variant_ids":[43756510642275]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316978787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513558627,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561506915,"product_id":7892618936419,"position":5,"created_at":"2025-10-02T09:50:57+08:00","updated_at":"2025-10-02T09:51:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860","variant_ids":[43756513558627]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316388963,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cb3c62e18a9702755e1b341a702dc148ab31ebc.webp?v=1759369860"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513591395,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561769059,"product_id":7892618936419,"position":7,"created_at":"2025-10-02T09:50:59+08:00","updated_at":"2025-10-02T09:51:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861","variant_ids":[43756513591395]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316683875,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c7f1d3190596955d3579dd005710450ff5a5c550.webp?v=1759369861"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513656931,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561015395,"product_id":7892618936419,"position":2,"created_at":"2025-10-02T09:50:55+08:00","updated_at":"2025-10-02T09:50:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858","variant_ids":[43756513656931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113315897443,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ed3fb6e5bf0bf0e4f9b5716b2c9897fbdead3a85.webp?v=1759369858"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756513788003,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543561310307,"product_id":7892618936419,"position":4,"created_at":"2025-10-02T09:50:57+08:00","updated_at":"2025-10-02T09:50:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859","variant_ids":[43756513788003]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316192355,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9506f15b8142b33442d31ef5406ebf0656cdddd.webp?v=1759369859"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43756510642275,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-AAR09","requires_shipping":true,"taxable":true,"featured_image":{"id":34543562096739,"product_id":7892618936419,"position":8,"created_at":"2025-10-02T09:51:02+08:00","updated_at":"2025-10-02T09:51:04+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864","variant_ids":[43756510642275]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Aaron Chang Take Ivy - 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-AAR09","featured_media":{"alt":null,"id":26113316978787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c5aaf9e6cab1a2f5cdcd7a229cca18d39c59098.webp?v=1759369864"}},"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: "停產"
}