$product = {"id":7888978804835,"title":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20","handle":"iphone-13-mini-solidsuit-classic-tb35","description":null,"published_at":"2025-09-24T11:09:19+08:00","created_at":"2025-09-23T12:12:52+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-oracle-redbull-racing","device-iPhone 13 Mini","merge","reseller-oracle-redbull-racing"],"price":83000,"price_min":83000,"price_max":83000,"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":43744927252579,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"SST01228Z9-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663029347,"product_id":7888978804835,"position":10,"created_at":"2026-07-02T14:55:19+08:00","updated_at":"2026-07-02T14:55:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321","variant_ids":[43744927252579]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228Z9-TB35","featured_media":{"alt":null,"id":27658536091747,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927318115,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0122852-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153662799971,"product_id":7888978804835,"position":9,"created_at":"2026-07-02T14:55:18+08:00","updated_at":"2026-07-02T14:55:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320","variant_ids":[43744927318115]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0122852-TB35","featured_media":{"alt":null,"id":27658535862371,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927350883,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"SST01228O8-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663455331,"product_id":7888978804835,"position":12,"created_at":"2026-07-02T14:55:20+08:00","updated_at":"2026-07-02T14:55:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322","variant_ids":[43744927350883]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228O8-TB35","featured_media":{"alt":null,"id":27658536517731,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927383651,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"SST01228Z8-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663225955,"product_id":7888978804835,"position":11,"created_at":"2026-07-02T14:55:19+08:00","updated_at":"2026-07-02T14:55:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321","variant_ids":[43744927383651]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228Z8-TB35","featured_media":{"alt":null,"id":27658536288355,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713.webp?v=1758600778","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff.webp?v=1758600779","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8598d4a19df3210cb5b9a4e3aa12e74c7389c31f.webp?v=1758600779","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411.webp?v=1758600780","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f543b6f9139632a0735fb28b6f4efd95623a71b.webp?v=1758600780","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3695cd983d1abce40a7cc4a44121b2b2d3a1a6fd.webp?v=1758600781","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c.webp?v=1758600781","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2c36cd967d2da43c122f85746ad4f0e91efbdfa.webp?v=1758600782","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713.webp?v=1758600778","options":["color"],"media":[{"alt":null,"id":26088871755875,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713.webp?v=1758600778"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713.webp?v=1758600778","width":2000},{"alt":null,"id":26088871919715,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff.webp?v=1758600779"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff.webp?v=1758600779","width":2000},{"alt":null,"id":26088872050787,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8598d4a19df3210cb5b9a4e3aa12e74c7389c31f.webp?v=1758600779"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8598d4a19df3210cb5b9a4e3aa12e74c7389c31f.webp?v=1758600779","width":2000},{"alt":null,"id":26088872214627,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411.webp?v=1758600780"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411.webp?v=1758600780","width":2000},{"alt":null,"id":26088872345699,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f543b6f9139632a0735fb28b6f4efd95623a71b.webp?v=1758600780"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f543b6f9139632a0735fb28b6f4efd95623a71b.webp?v=1758600780","width":2000},{"alt":null,"id":26088872476771,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3695cd983d1abce40a7cc4a44121b2b2d3a1a6fd.webp?v=1758600781"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3695cd983d1abce40a7cc4a44121b2b2d3a1a6fd.webp?v=1758600781","width":2000},{"alt":null,"id":26088872542307,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c.webp?v=1758600781"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c.webp?v=1758600781","width":2000},{"alt":null,"id":26088872673379,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2c36cd967d2da43c122f85746ad4f0e91efbdfa.webp?v=1758600782"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2c36cd967d2da43c122f85746ad4f0e91efbdfa.webp?v=1758600782","width":2000},{"alt":null,"id":27658535862371,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320","width":2000},{"alt":null,"id":27658536091747,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321","width":2000},{"alt":null,"id":27658536288355,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321","width":2000},{"alt":null,"id":27658536517731,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43744927252579,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"SST01228Z9-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663029347,"product_id":7888978804835,"position":10,"created_at":"2026-07-02T14:55:19+08:00","updated_at":"2026-07-02T14:55:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321","variant_ids":[43744927252579]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228Z9-TB35","featured_media":{"alt":null,"id":27658536091747,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927318115,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0122852-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153662799971,"product_id":7888978804835,"position":9,"created_at":"2026-07-02T14:55:18+08:00","updated_at":"2026-07-02T14:55:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320","variant_ids":[43744927318115]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0122852-TB35","featured_media":{"alt":null,"id":27658535862371,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab5fea0ff68d5af0413f9a9c288d2cd44beba2ff_9479943b-011b-4420-903c-3161856c089e.webp?v=1782975320"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927350883,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"SST01228O8-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663455331,"product_id":7888978804835,"position":12,"created_at":"2026-07-02T14:55:20+08:00","updated_at":"2026-07-02T14:55:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322","variant_ids":[43744927350883]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228O8-TB35","featured_media":{"alt":null,"id":27658536517731,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a3017097a6450543dc282fea19046af6bea39713_0106636c-34c5-4df4-9df1-2dc9485e842b.webp?v=1782975322"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43744927383651,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"SST01228Z8-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663225955,"product_id":7888978804835,"position":11,"created_at":"2026-07-02T14:55:19+08:00","updated_at":"2026-07-02T14:55:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321","variant_ids":[43744927383651]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228Z8-TB35","featured_media":{"alt":null,"id":27658536288355,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fabf8ee3cdc75c481a7c7f995379de9ac5b2699c_c3d65e8b-1cd3-4ba7-a83e-f5ea661ffcad.webp?v=1782975321"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43744927252579,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"SST01228Z9-TB35","requires_shipping":true,"taxable":true,"featured_image":{"id":36153663029347,"product_id":7888978804835,"position":10,"created_at":"2026-07-02T14:55:19+08:00","updated_at":"2026-07-02T14:55:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321","variant_ids":[43744927252579]},"available":true,"name":"iPhone 13 mini SolidSuit Oracle Red Bull Racing ORBR - RB20 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01228Z9-TB35","featured_media":{"alt":null,"id":27658536091747,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d00613c9e992790d0c472b9c5c629e11227ce411_7a92562c-0b1f-4b2e-ac6d-44ff0dda660b.webp?v=1782975321"}},"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: "停產"
}