$product = {"id":7942265241699,"title":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean","handle":"iphone-12-pro-mod-nx-seu01","description":null,"published_at":"2025-12-23T09:33:47+08:00","created_at":"2025-12-22T17:42:36+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-seungyounkim","device-iPhone 12 Pro","merge","reseller-seungyounkim"],"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":43904420708451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987594088547,"product_id":7942265241699,"position":1,"created_at":"2025-12-22T17:43:13+08:00","updated_at":"2025-12-22T17:43:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","variant_ids":[43904420708451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548610957411,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421003363,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987596742755,"product_id":7942265241699,"position":9,"created_at":"2025-12-22T17:43:17+08:00","updated_at":"2025-12-22T17:43:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599","variant_ids":[43904421003363]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548613546083,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421232739,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987595169891,"product_id":7942265241699,"position":5,"created_at":"2025-12-22T17:43:15+08:00","updated_at":"2025-12-22T17:43:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597","variant_ids":[43904421232739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548612038755,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421986403,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987594645603,"product_id":7942265241699,"position":3,"created_at":"2025-12-22T17:43:14+08:00","updated_at":"2025-12-22T17:43:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596","variant_ids":[43904421986403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548611514467,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904423526499,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987596382307,"product_id":7942265241699,"position":8,"created_at":"2025-12-22T17:43:16+08:00","updated_at":"2025-12-22T17:43:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598","variant_ids":[43904423526499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548613185635,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/123862e69e234f113250cc753034c401f952c2b2.webp?v=1766396595","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84bfa1a30f17f5f0f963375f352696868f1321d6.webp?v=1766396596","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c7481ef4053d9d1f1fd4f5dedd710fa55538583.webp?v=1766396597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ee9f5ea9b04993649812c758579e94b55c57b74.webp?v=1766396598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa613a24df368e7611d8d2f84636852a3b1813a9.webp?v=1766396599","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b0faf12ec8abcf153854209359e6bebec643ab3.webp?v=1766396600"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","options":["color"],"media":[{"alt":null,"id":26548610957411,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","width":2000},{"alt":null,"id":26548611219555,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/123862e69e234f113250cc753034c401f952c2b2.webp?v=1766396595"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/123862e69e234f113250cc753034c401f952c2b2.webp?v=1766396595","width":2000},{"alt":null,"id":26548611514467,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596","width":2000},{"alt":null,"id":26548611809379,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84bfa1a30f17f5f0f963375f352696868f1321d6.webp?v=1766396596"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84bfa1a30f17f5f0f963375f352696868f1321d6.webp?v=1766396596","width":2000},{"alt":null,"id":26548612038755,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597","width":2000},{"alt":null,"id":26548612268131,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c7481ef4053d9d1f1fd4f5dedd710fa55538583.webp?v=1766396597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2c7481ef4053d9d1f1fd4f5dedd710fa55538583.webp?v=1766396597","width":2000},{"alt":null,"id":26548612694115,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ee9f5ea9b04993649812c758579e94b55c57b74.webp?v=1766396598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ee9f5ea9b04993649812c758579e94b55c57b74.webp?v=1766396598","width":2000},{"alt":null,"id":26548613185635,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598","width":2000},{"alt":null,"id":26548613546083,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599","width":2000},{"alt":null,"id":26548613939299,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa613a24df368e7611d8d2f84636852a3b1813a9.webp?v=1766396599"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa613a24df368e7611d8d2f84636852a3b1813a9.webp?v=1766396599","width":2000},{"alt":null,"id":26548614496355,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b0faf12ec8abcf153854209359e6bebec643ab3.webp?v=1766396600"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b0faf12ec8abcf153854209359e6bebec643ab3.webp?v=1766396600","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43904420708451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987594088547,"product_id":7942265241699,"position":1,"created_at":"2025-12-22T17:43:13+08:00","updated_at":"2025-12-22T17:43:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","variant_ids":[43904420708451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548610957411,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421003363,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01185J5-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987596742755,"product_id":7942265241699,"position":9,"created_at":"2025-12-22T17:43:17+08:00","updated_at":"2025-12-22T17:43:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599","variant_ids":[43904421003363]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548613546083,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5eff01542ad0979f76c7df39e7f623a120eebd2b.webp?v=1766396599"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421232739,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118524-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987595169891,"product_id":7942265241699,"position":5,"created_at":"2025-12-22T17:43:15+08:00","updated_at":"2025-12-22T17:43:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597","variant_ids":[43904421232739]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548612038755,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d0e12a795260096e4ef201209674232f3a9eb6b.webp?v=1766396597"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904421986403,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NPB0118569-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987594645603,"product_id":7942265241699,"position":3,"created_at":"2025-12-22T17:43:14+08:00","updated_at":"2025-12-22T17:43:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596","variant_ids":[43904421986403]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548611514467,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26eac646cba013236cda1f44c4966a49721c9cbd.webp?v=1766396596"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43904423526499,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0118504-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987596382307,"product_id":7942265241699,"position":8,"created_at":"2025-12-22T17:43:16+08:00","updated_at":"2025-12-22T17:43:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598","variant_ids":[43904423526499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548613185635,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3bbf82e57ca4ad69795c8cd15f0348953c654b4.webp?v=1766396598"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43904420708451,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01185C1-SEU01","requires_shipping":true,"taxable":true,"featured_image":{"id":34987594088547,"product_id":7942265241699,"position":1,"created_at":"2025-12-22T17:43:13+08:00","updated_at":"2025-12-22T17:43:15+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595","variant_ids":[43904420708451]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX Seungyoun Kim 窗簾小狗 Maestro Bean - 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-SEU01","featured_media":{"alt":null,"id":26548610957411,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e75b806aa41f4dac99eb24ec29538dcb02a913c.webp?v=1766396595"}},"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: "停產"
}