$product = {"id":7769835077731,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf49","description":null,"published_at":"2025-04-16T14:09:41+08:00","created_at":"2025-04-15T21:01:16+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX MagSafe專區I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone 14 Pro","merge","reseller-ilovedoodle"],"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":43304151122019,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712404579,"product_id":7769835077731,"position":13,"created_at":"2025-07-16T15:21:27+08:00","updated_at":"2025-07-16T15:21:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489","variant_ids":[43304151122019]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF49","featured_media":{"alt":null,"id":25830063079523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304158199907,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197709193315,"product_id":7769835077731,"position":7,"created_at":"2025-07-16T15:21:23+08:00","updated_at":"2025-07-16T15:21:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485","variant_ids":[43304158199907]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF49","featured_media":{"alt":null,"id":25830060818531,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304158363747,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197704441955,"product_id":7769835077731,"position":3,"created_at":"2025-07-16T15:21:21+08:00","updated_at":"2025-07-16T15:21:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482","variant_ids":[43304158363747]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - 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":"MPB01262J5-XF49","featured_media":{"alt":null,"id":25830058033251,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/edef41b54f80e131dc7e51a78003e6440c195f86_4613d322-c403-4435-8512-26c95f00c54f.webp?v=1744722084","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1050e4366201a7c7ba23e10572d03994f7dda18c_98968261-67e4-4db4-aa9f-aadd4dd91482.webp?v=1752650482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcdf331604a542c8140cd99ef1865e9cee1764a5_4e655fc8-eada-413c-a1b7-93c5c69c2b43.webp?v=1752650483","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81e1707e0566605e0f82d5a01f4d9b2548239015_6ec94ec5-5719-4d7a-b875-4493bf92585f.webp?v=1752650484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11cd34268cac01d7cf539edbb9b2537640444b2f_176faac3-acae-489b-98a8-77e70b225255.webp?v=1752650484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4b34454024575c304aedd517988ce11d77d0aed_ce1cff61-b880-4bb7-a413-7de06f04ea21.webp?v=1752650486","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8580e3e4abf73d821186e2667784d712eb6e165_53a0d909-87a5-4c73-a24a-b8ef5e65b9b2.webp?v=1752650486","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19676ffa213850185502f8f5bd65c09dcfe1b8b2_5bdecd6d-078d-493b-9ecd-06ef76183352.webp?v=1752650487","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d6e75be441998faed890a2979b2e42b25cff0bd_8c96d9b7-60c4-40e2-aac5-64b2d81361d9.webp?v=1752650488","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bd769be92e5f638cb326f9a0a1977aaf33e7e_cb78bd1c-0214-4ae9-93c5-9b7be6e545e0.webp?v=1752650488","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/edef41b54f80e131dc7e51a78003e6440c195f86_4613d322-c403-4435-8512-26c95f00c54f.webp?v=1744722084","options":["color"],"media":[{"alt":null,"id":25496337186915,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/edef41b54f80e131dc7e51a78003e6440c195f86_4613d322-c403-4435-8512-26c95f00c54f.webp?v=1744722084"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/edef41b54f80e131dc7e51a78003e6440c195f86_4613d322-c403-4435-8512-26c95f00c54f.webp?v=1744722084","width":2000},{"alt":null,"id":25830057279587,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1050e4366201a7c7ba23e10572d03994f7dda18c_98968261-67e4-4db4-aa9f-aadd4dd91482.webp?v=1752650482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1050e4366201a7c7ba23e10572d03994f7dda18c_98968261-67e4-4db4-aa9f-aadd4dd91482.webp?v=1752650482","width":2000},{"alt":null,"id":25830058033251,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482","width":2000},{"alt":null,"id":25830058655843,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcdf331604a542c8140cd99ef1865e9cee1764a5_4e655fc8-eada-413c-a1b7-93c5c69c2b43.webp?v=1752650483"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fcdf331604a542c8140cd99ef1865e9cee1764a5_4e655fc8-eada-413c-a1b7-93c5c69c2b43.webp?v=1752650483","width":2000},{"alt":null,"id":25830059573347,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81e1707e0566605e0f82d5a01f4d9b2548239015_6ec94ec5-5719-4d7a-b875-4493bf92585f.webp?v=1752650484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/81e1707e0566605e0f82d5a01f4d9b2548239015_6ec94ec5-5719-4d7a-b875-4493bf92585f.webp?v=1752650484","width":2000},{"alt":null,"id":25830060097635,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11cd34268cac01d7cf539edbb9b2537640444b2f_176faac3-acae-489b-98a8-77e70b225255.webp?v=1752650484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/11cd34268cac01d7cf539edbb9b2537640444b2f_176faac3-acae-489b-98a8-77e70b225255.webp?v=1752650484","width":2000},{"alt":null,"id":25830060818531,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485","width":2000},{"alt":null,"id":25830061408355,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4b34454024575c304aedd517988ce11d77d0aed_ce1cff61-b880-4bb7-a413-7de06f04ea21.webp?v=1752650486"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d4b34454024575c304aedd517988ce11d77d0aed_ce1cff61-b880-4bb7-a413-7de06f04ea21.webp?v=1752650486","width":2000},{"alt":null,"id":25830061998179,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8580e3e4abf73d821186e2667784d712eb6e165_53a0d909-87a5-4c73-a24a-b8ef5e65b9b2.webp?v=1752650486"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b8580e3e4abf73d821186e2667784d712eb6e165_53a0d909-87a5-4c73-a24a-b8ef5e65b9b2.webp?v=1752650486","width":2000},{"alt":null,"id":25830062391395,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19676ffa213850185502f8f5bd65c09dcfe1b8b2_5bdecd6d-078d-493b-9ecd-06ef76183352.webp?v=1752650487"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19676ffa213850185502f8f5bd65c09dcfe1b8b2_5bdecd6d-078d-493b-9ecd-06ef76183352.webp?v=1752650487","width":2000},{"alt":null,"id":25830062686307,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d6e75be441998faed890a2979b2e42b25cff0bd_8c96d9b7-60c4-40e2-aac5-64b2d81361d9.webp?v=1752650488"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2d6e75be441998faed890a2979b2e42b25cff0bd_8c96d9b7-60c4-40e2-aac5-64b2d81361d9.webp?v=1752650488","width":2000},{"alt":null,"id":25830062948451,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bd769be92e5f638cb326f9a0a1977aaf33e7e_cb78bd1c-0214-4ae9-93c5-9b7be6e545e0.webp?v=1752650488"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a88bd769be92e5f638cb326f9a0a1977aaf33e7e_cb78bd1c-0214-4ae9-93c5-9b7be6e545e0.webp?v=1752650488","width":2000},{"alt":null,"id":25830063079523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43304151122019,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712404579,"product_id":7769835077731,"position":13,"created_at":"2025-07-16T15:21:27+08:00","updated_at":"2025-07-16T15:21:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489","variant_ids":[43304151122019]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF49","featured_media":{"alt":null,"id":25830063079523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304158199907,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197709193315,"product_id":7769835077731,"position":7,"created_at":"2025-07-16T15:21:23+08:00","updated_at":"2025-07-16T15:21:25+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485","variant_ids":[43304158199907]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF49","featured_media":{"alt":null,"id":25830060818531,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c5a2008303289c7c2fc31f6052c48d5b93f194a7_919020b4-9f4d-4a27-8761-ebc2f8e1f553.webp?v=1752650485"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304158363747,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197704441955,"product_id":7769835077731,"position":3,"created_at":"2025-07-16T15:21:21+08:00","updated_at":"2025-07-16T15:21:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482","variant_ids":[43304158363747]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - 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":"MPB01262J5-XF49","featured_media":{"alt":null,"id":25830058033251,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4f15ac2836a445c4c424aad10d40578f0bedb94b_dec28dc8-94d7-43f3-8c6d-04ea7762b82d.webp?v=1752650482"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43304151122019,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF49","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712404579,"product_id":7769835077731,"position":13,"created_at":"2025-07-16T15:21:27+08:00","updated_at":"2025-07-16T15:21:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489","variant_ids":[43304151122019]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle White Cat Flowers - 白貓花朵 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF49","featured_media":{"alt":null,"id":25830063079523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5bccb05ec45877fde1fa6e7b46580b29a86e9add_47842e2a-33fa-4281-bcbc-870196893ccd.webp?v=1752650489"}},"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: "停產"
}