$product = {"id":7937861517411,"title":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼","handle":"iphone-12-mini-solidsuit-classic-xu07","description":null,"published_at":"2025-12-12T10:45:13+08:00","created_at":"2025-12-11T15:44:38+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-attack-on-titan","device-iPhone 12 Mini","merge","reseller-attack-on-titan"],"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":43884184436835,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225790869603,"product_id":7937861517411,"position":13,"created_at":"2026-07-09T09:33:57+08:00","updated_at":"2026-07-09T09:34:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840","variant_ids":[43884184436835]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU07","featured_media":{"alt":null,"id":27730576506979,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884184502371,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225790214243,"product_id":7937861517411,"position":12,"created_at":"2026-07-09T09:33:56+08:00","updated_at":"2026-07-09T09:33:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838","variant_ids":[43884184502371]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-XU07","featured_media":{"alt":null,"id":27730575851619,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884184535139,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225792311395,"product_id":7937861517411,"position":15,"created_at":"2026-07-09T09:33:59+08:00","updated_at":"2026-07-09T09:34:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841","variant_ids":[43884184535139]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-XU07","featured_media":{"alt":null,"id":27730577948771,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02142ce2ce1b63bb0af6e3e62595888074511707.webp?v=1765439084","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d.webp?v=1765439084","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc.webp?v=1765439084","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0.webp?v=1765439087","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07.webp?v=1765439088","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3.webp?v=1765439088","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ee4f8e66ff57c6e71a7ab59497a03bbeda5a35e5.webp?v=1765439089","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562.webp?v=1765439089","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b60c58642781aacc99a4defb04513a772c6af53.webp?v=1765439090","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07_b25ed0a1-5bcd-4750-9d5c-a03c5d3b5508.webp?v=1783560836","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc_ab07e4b3-a404-46cb-8a93-29d98e53b20e.webp?v=1783560837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562_af8c4581-df72-4b0d-a9ca-5b2f137e03e9.webp?v=1783560840","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02142ce2ce1b63bb0af6e3e62595888074511707.webp?v=1765439084","options":["color"],"media":[{"alt":null,"id":26495214125155,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02142ce2ce1b63bb0af6e3e62595888074511707.webp?v=1765439084"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02142ce2ce1b63bb0af6e3e62595888074511707.webp?v=1765439084","width":2000},{"alt":null,"id":26495214288995,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d.webp?v=1765439084"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d.webp?v=1765439084","width":2000},{"alt":null,"id":26495214485603,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc.webp?v=1765439084"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc.webp?v=1765439084","width":2000},{"alt":null,"id":26495214616675,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0.webp?v=1765439087"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0.webp?v=1765439087","width":2000},{"alt":null,"id":26495215304803,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07.webp?v=1765439088"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07.webp?v=1765439088","width":2000},{"alt":null,"id":26495215665251,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3.webp?v=1765439088"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3.webp?v=1765439088","width":2000},{"alt":null,"id":26495215861859,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ee4f8e66ff57c6e71a7ab59497a03bbeda5a35e5.webp?v=1765439089"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ee4f8e66ff57c6e71a7ab59497a03bbeda5a35e5.webp?v=1765439089","width":2000},{"alt":null,"id":26495216025699,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562.webp?v=1765439089"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562.webp?v=1765439089","width":2000},{"alt":null,"id":26495216124003,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b60c58642781aacc99a4defb04513a772c6af53.webp?v=1765439090"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b60c58642781aacc99a4defb04513a772c6af53.webp?v=1765439090","width":2000},{"alt":null,"id":27730574508131,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07_b25ed0a1-5bcd-4750-9d5c-a03c5d3b5508.webp?v=1783560836"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f5780e119ad1ba9ce501926d812b7af5c9791b07_b25ed0a1-5bcd-4750-9d5c-a03c5d3b5508.webp?v=1783560836","width":2000},{"alt":null,"id":27730575130723,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc_ab07e4b3-a404-46cb-8a93-29d98e53b20e.webp?v=1783560837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1626d25683845bfe45f5e83a461f724db6db14cc_ab07e4b3-a404-46cb-8a93-29d98e53b20e.webp?v=1783560837","width":2000},{"alt":null,"id":27730575851619,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838","width":2000},{"alt":null,"id":27730576506979,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840","width":2000},{"alt":null,"id":27730577391715,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562_af8c4581-df72-4b0d-a9ca-5b2f137e03e9.webp?v=1783560840"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13acc4930641e8fc134065f4fbd994b8096b1562_af8c4581-df72-4b0d-a9ca-5b2f137e03e9.webp?v=1783560840","width":2000},{"alt":null,"id":27730577948771,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43884184436835,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225790869603,"product_id":7937861517411,"position":13,"created_at":"2026-07-09T09:33:57+08:00","updated_at":"2026-07-09T09:34:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840","variant_ids":[43884184436835]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU07","featured_media":{"alt":null,"id":27730576506979,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884184502371,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225790214243,"product_id":7937861517411,"position":12,"created_at":"2026-07-09T09:33:56+08:00","updated_at":"2026-07-09T09:33:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838","variant_ids":[43884184502371]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-XU07","featured_media":{"alt":null,"id":27730575851619,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6d1ac3d258900a64a1d84a0ae477d86a76b644b3_7e6ea112-2950-4ebd-a495-aab69c6da129.webp?v=1783560838"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884184535139,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225792311395,"product_id":7937861517411,"position":15,"created_at":"2026-07-09T09:33:59+08:00","updated_at":"2026-07-09T09:34:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841","variant_ids":[43884184535139]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-XU07","featured_media":{"alt":null,"id":27730577948771,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1dfd50ffc69d682b32fbd7da039cd19cab32f9f0_7da10d4b-44d1-4021-a471-cb6350aac362.webp?v=1783560841"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43884184436835,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU07","requires_shipping":true,"taxable":true,"featured_image":{"id":36225790869603,"product_id":7937861517411,"position":13,"created_at":"2026-07-09T09:33:57+08:00","updated_at":"2026-07-09T09:34:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840","variant_ids":[43884184436835]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 元素拼貼 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU07","featured_media":{"alt":null,"id":27730576506979,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e76d6bd3d147cf80cd3736a3a2778e3b13a5956d_bc798008-f1a5-40ef-991b-804f462ddd7a.webp?v=1783560840"}},"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: "停產"
}