$product = {"id":7893813461091,"title":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩","handle":"iphone-12-pro-mod-nx-printable-chu05","description":null,"published_at":"2025-10-09T09:32:52+08:00","created_at":"2025-10-07T10:17:44+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-chubbynida","device-iPhone 12 Pro","merge","reseller-chubbynida"],"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":43763363086435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553095159907,"product_id":7893813461091,"position":4,"created_at":"2025-10-07T10:17:47+08:00","updated_at":"2025-10-07T10:17:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469","variant_ids":[43763363086435]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742857827,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365773411,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553094570083,"product_id":7893813461091,"position":1,"created_at":"2025-10-07T10:17:45+08:00","updated_at":"2025-10-07T10:17:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467","variant_ids":[43763365773411]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742268003,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365838947,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553096568931,"product_id":7893813461091,"position":10,"created_at":"2025-10-07T10:17:53+08:00","updated_at":"2025-10-07T10:17:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475","variant_ids":[43763365838947]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122744266851,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365904483,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553094799459,"product_id":7893813461091,"position":2,"created_at":"2025-10-07T10:17:46+08:00","updated_at":"2025-10-07T10:17:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468","variant_ids":[43763365904483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742497379,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365937251,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553095684195,"product_id":7893813461091,"position":6,"created_at":"2025-10-07T10:17:50+08:00","updated_at":"2025-10-07T10:17:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472","variant_ids":[43763365937251]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122743382115,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8133e2d31e6e8741bf34e4f76feec6755255a003.webp?v=1759803468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97bc4ac81ef88ec1d2dd3788e76a4a57ca48c429.webp?v=1759803471","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6dea79684945f26afa6f204232e6f22a9fc6f453.webp?v=1759803473","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa13763b1e71bd546e69dcbc4a3355590d5a3b44.webp?v=1759803474","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/10defe46a7f86642fb2ef8291c89203aef5b17e9.webp?v=1759803474","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/504ff0cc1738ccf6d3041620181f1b2543617c2e.webp?v=1759803476"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467","options":["color"],"media":[{"alt":null,"id":26122742268003,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467","width":2000},{"alt":null,"id":26122742497379,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468","width":2000},{"alt":null,"id":26122742661219,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8133e2d31e6e8741bf34e4f76feec6755255a003.webp?v=1759803468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8133e2d31e6e8741bf34e4f76feec6755255a003.webp?v=1759803468","width":2000},{"alt":null,"id":26122742857827,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469","width":2000},{"alt":null,"id":26122743185507,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97bc4ac81ef88ec1d2dd3788e76a4a57ca48c429.webp?v=1759803471"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/97bc4ac81ef88ec1d2dd3788e76a4a57ca48c429.webp?v=1759803471","width":2000},{"alt":null,"id":26122743382115,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472","width":2000},{"alt":null,"id":26122743644259,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6dea79684945f26afa6f204232e6f22a9fc6f453.webp?v=1759803473"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6dea79684945f26afa6f204232e6f22a9fc6f453.webp?v=1759803473","width":2000},{"alt":null,"id":26122743873635,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa13763b1e71bd546e69dcbc4a3355590d5a3b44.webp?v=1759803474"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa13763b1e71bd546e69dcbc4a3355590d5a3b44.webp?v=1759803474","width":2000},{"alt":null,"id":26122744037475,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/10defe46a7f86642fb2ef8291c89203aef5b17e9.webp?v=1759803474"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/10defe46a7f86642fb2ef8291c89203aef5b17e9.webp?v=1759803474","width":2000},{"alt":null,"id":26122744266851,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475","width":2000},{"alt":null,"id":26122744528995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/504ff0cc1738ccf6d3041620181f1b2543617c2e.webp?v=1759803476"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/504ff0cc1738ccf6d3041620181f1b2543617c2e.webp?v=1759803476","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43763363086435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553095159907,"product_id":7893813461091,"position":4,"created_at":"2025-10-07T10:17:47+08:00","updated_at":"2025-10-07T10:17:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469","variant_ids":[43763363086435]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742857827,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365773411,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553094570083,"product_id":7893813461091,"position":1,"created_at":"2025-10-07T10:17:45+08:00","updated_at":"2025-10-07T10:17:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467","variant_ids":[43763365773411]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742268003,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3eeba90362aa71d366500142dcc2751bbdddfaf.webp?v=1759803467"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365838947,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553096568931,"product_id":7893813461091,"position":10,"created_at":"2025-10-07T10:17:53+08:00","updated_at":"2025-10-07T10:17:55+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475","variant_ids":[43763365838947]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122744266851,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fca02d1b2d53b5c75c4d9359b5d9ef0853e8c093.webp?v=1759803475"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365904483,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553094799459,"product_id":7893813461091,"position":2,"created_at":"2025-10-07T10:17:46+08:00","updated_at":"2025-10-07T10:17:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468","variant_ids":[43763365904483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742497379,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6d5dca1bba14682b445e57afa0accf00e4bb24.webp?v=1759803468"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43763365937251,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553095684195,"product_id":7893813461091,"position":6,"created_at":"2025-10-07T10:17:50+08:00","updated_at":"2025-10-07T10:17:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472","variant_ids":[43763365937251]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122743382115,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2bc90f6cee0cc03417c06d9f4e9202959333b0d6.webp?v=1759803472"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43763363086435,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-CHU05","requires_shipping":true,"taxable":true,"featured_image":{"id":34553095159907,"product_id":7893813461091,"position":4,"created_at":"2025-10-07T10:17:47+08:00","updated_at":"2025-10-07T10:17:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469","variant_ids":[43763363086435]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Chubbynida 悠游海之詩 - 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-CHU05","featured_media":{"alt":null,"id":26122742857827,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c205418598c76abe36346178bf32aa0c72d5150.webp?v=1759803469"}},"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: "停產"
}