$product = {"id":7892631879779,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse","handle":"iphone-12-pro-mod-nx-magsafe-printable-aar05","description":null,"published_at":"2025-10-03T09:49:00+08:00","created_at":"2025-10-02T09:56:11+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":110000,"price_min":110000,"price_max":110000,"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":43756558352483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543611150435,"product_id":7892631879779,"position":3,"created_at":"2025-10-02T09:56:18+08:00","updated_at":"2025-10-02T09:56:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180","variant_ids":[43756558352483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-AAR05","featured_media":{"alt":null,"id":26113366032483,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562776163,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543611740259,"product_id":7892631879779,"position":5,"created_at":"2025-10-02T09:56:19+08:00","updated_at":"2025-10-02T09:56:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181","variant_ids":[43756562776163]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-AAR05","featured_media":{"alt":null,"id":26113366589539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562808931,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543610298467,"product_id":7892631879779,"position":1,"created_at":"2025-10-02T09:56:16+08:00","updated_at":"2025-10-02T09:56:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178","variant_ids":[43756562808931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-AAR05","featured_media":{"alt":null,"id":26113365180515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562874467,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543612264547,"product_id":7892631879779,"position":7,"created_at":"2025-10-02T09:56:21+08:00","updated_at":"2025-10-02T09:56:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183","variant_ids":[43756562874467]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-AAR05","featured_media":{"alt":null,"id":26113367146595,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756563005539,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543613182051,"product_id":7892631879779,"position":11,"created_at":"2025-10-02T09:56:23+08:00","updated_at":"2025-10-02T09:56:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185","variant_ids":[43756563005539]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-AAR05","featured_media":{"alt":null,"id":26113368064099,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/03aae97f50c1bdfd3fa3bf725cf890e89d29914c.webp?v=1759370179","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d764870c4ecb3b464a54e4ac60f08c2da773ea54.webp?v=1759370180","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6361f3e43f6029c0d1bceb513bc39f6e9fc9679a.webp?v=1759370182","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be41f3e6dab9739fa96a078432c0e34ea1d20368.webp?v=1759370183","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7b583efbf636e290acd7b1f95d855b9e87b6bf.webp?v=1759370184","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f80b953bfc919191ef29024fc7dcf9e1fa13f042.webp?v=1759370185","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178","options":["color"],"media":[{"alt":null,"id":26113365180515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178","width":2000},{"alt":null,"id":26113365770339,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/03aae97f50c1bdfd3fa3bf725cf890e89d29914c.webp?v=1759370179"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/03aae97f50c1bdfd3fa3bf725cf890e89d29914c.webp?v=1759370179","width":2000},{"alt":null,"id":26113366032483,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180","width":2000},{"alt":null,"id":26113366327395,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d764870c4ecb3b464a54e4ac60f08c2da773ea54.webp?v=1759370180"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d764870c4ecb3b464a54e4ac60f08c2da773ea54.webp?v=1759370180","width":2000},{"alt":null,"id":26113366589539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181","width":2000},{"alt":null,"id":26113366851683,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6361f3e43f6029c0d1bceb513bc39f6e9fc9679a.webp?v=1759370182"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6361f3e43f6029c0d1bceb513bc39f6e9fc9679a.webp?v=1759370182","width":2000},{"alt":null,"id":26113367146595,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183","width":2000},{"alt":null,"id":26113367375971,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be41f3e6dab9739fa96a078432c0e34ea1d20368.webp?v=1759370183"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be41f3e6dab9739fa96a078432c0e34ea1d20368.webp?v=1759370183","width":2000},{"alt":null,"id":26113367572579,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7b583efbf636e290acd7b1f95d855b9e87b6bf.webp?v=1759370184"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7b583efbf636e290acd7b1f95d855b9e87b6bf.webp?v=1759370184","width":2000},{"alt":null,"id":26113367801955,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f80b953bfc919191ef29024fc7dcf9e1fa13f042.webp?v=1759370185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f80b953bfc919191ef29024fc7dcf9e1fa13f042.webp?v=1759370185","width":2000},{"alt":null,"id":26113368064099,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43756558352483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543611150435,"product_id":7892631879779,"position":3,"created_at":"2025-10-02T09:56:18+08:00","updated_at":"2025-10-02T09:56:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180","variant_ids":[43756558352483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-AAR05","featured_media":{"alt":null,"id":26113366032483,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562776163,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543611740259,"product_id":7892631879779,"position":5,"created_at":"2025-10-02T09:56:19+08:00","updated_at":"2025-10-02T09:56:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181","variant_ids":[43756562776163]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-AAR05","featured_media":{"alt":null,"id":26113366589539,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dacce76ded4bd1fb24bf029159fc4922314e7d4f.webp?v=1759370181"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562808931,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543610298467,"product_id":7892631879779,"position":1,"created_at":"2025-10-02T09:56:16+08:00","updated_at":"2025-10-02T09:56:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178","variant_ids":[43756562808931]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-AAR05","featured_media":{"alt":null,"id":26113365180515,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1e2385653a91847af6956f4d7fd5ced7f686cd.webp?v=1759370178"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756562874467,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543612264547,"product_id":7892631879779,"position":7,"created_at":"2025-10-02T09:56:21+08:00","updated_at":"2025-10-02T09:56:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183","variant_ids":[43756562874467]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-AAR05","featured_media":{"alt":null,"id":26113367146595,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91f216904c407759f381db780ed23682787f37a1.webp?v=1759370183"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43756563005539,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543613182051,"product_id":7892631879779,"position":11,"created_at":"2025-10-02T09:56:23+08:00","updated_at":"2025-10-02T09:56:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185","variant_ids":[43756563005539]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-AAR05","featured_media":{"alt":null,"id":26113368064099,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86ce692140a673ad190471d56beb0c9a550cb659.webp?v=1759370185"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43756558352483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-AAR05","requires_shipping":true,"taxable":true,"featured_image":{"id":34543611150435,"product_id":7892631879779,"position":3,"created_at":"2025-10-02T09:56:18+08:00","updated_at":"2025-10-02T09:56:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180","variant_ids":[43756558352483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) Aaron Chang Unirverse - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-AAR05","featured_media":{"alt":null,"id":26113366032483,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c30c8311ccb8d34709e859e0997353ea5c8dda47.webp?v=1759370180"}},"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: "停產"
}