$product = {"id":7769861193827,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf50","description":null,"published_at":"2025-04-16T13:57:58+08:00","created_at":"2025-04-15T21:22:24+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":43304282783843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712044131,"product_id":7769861193827,"position":12,"created_at":"2025-07-16T15:21:26+08:00","updated_at":"2025-07-16T15:21:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488","variant_ids":[43304282783843]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830062850147,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304287764579,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712339043,"product_id":7769861193827,"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\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489","variant_ids":[43304287764579]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830063046755,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304287928419,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197709258851,"product_id":7769861193827,"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\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485","variant_ids":[43304287928419]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830060752995,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0.webp?v=1744723351","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b0cb539802236e9faa2f665bb477e95ef47ad3f_0b46aff9-b1ca-44bd-b88e-93d372254d7f.webp?v=1752650482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/424e440770afcd3763fc2e03e1370caf48da1b98_67bef3d5-0ebe-4aed-a550-79c403fb6480.webp?v=1752650483","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c52369644e9aa90ae0b55d908f82a9ca1e849757_50b1da70-9a41-46a5-995b-b1df6585688f.webp?v=1752650483","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6f18ae91b5c0059185145fc59ba6d07145c52bc_903caee9-7e1d-4738-bbb3-b3b47c895f3b.webp?v=1752650484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e420208f2209603a339fcc5739ef9fa90b0142d_e3dc9fab-b405-48c3-b95e-ffd9fa59912b.webp?v=1752650484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0cd2e7fca4606f4d23700fc588cadc31322c354f_f9e8d82c-f055-47ef-8625-c01286a5c71c.webp?v=1752650486","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/560f915d80286e5f5c564e783057996b39371f31_b00c8fd9-b912-4640-a018-1cb26d61fe75.webp?v=1752650486","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6472a083402e3968e96a858d8e10ac041301ba7f_e5925555-0bcb-4bd2-b149-7b4c2e10cf01.webp?v=1752650487","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d227beaf7eb4101d30480e556f1bdb58dbf2b0b4_4711da64-f7ee-4416-a6b9-d6fb02318c6c.webp?v=1752650487","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0.webp?v=1744723351","options":["color"],"media":[{"alt":null,"id":25496376934499,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0.webp?v=1744723351"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0.webp?v=1744723351","width":2000},{"alt":null,"id":25830057508963,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b0cb539802236e9faa2f665bb477e95ef47ad3f_0b46aff9-b1ca-44bd-b88e-93d372254d7f.webp?v=1752650482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2b0cb539802236e9faa2f665bb477e95ef47ad3f_0b46aff9-b1ca-44bd-b88e-93d372254d7f.webp?v=1752650482","width":2000},{"alt":null,"id":25830058131555,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/424e440770afcd3763fc2e03e1370caf48da1b98_67bef3d5-0ebe-4aed-a550-79c403fb6480.webp?v=1752650483"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/424e440770afcd3763fc2e03e1370caf48da1b98_67bef3d5-0ebe-4aed-a550-79c403fb6480.webp?v=1752650483","width":2000},{"alt":null,"id":25830058754147,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c52369644e9aa90ae0b55d908f82a9ca1e849757_50b1da70-9a41-46a5-995b-b1df6585688f.webp?v=1752650483"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c52369644e9aa90ae0b55d908f82a9ca1e849757_50b1da70-9a41-46a5-995b-b1df6585688f.webp?v=1752650483","width":2000},{"alt":null,"id":25830059638883,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6f18ae91b5c0059185145fc59ba6d07145c52bc_903caee9-7e1d-4738-bbb3-b3b47c895f3b.webp?v=1752650484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d6f18ae91b5c0059185145fc59ba6d07145c52bc_903caee9-7e1d-4738-bbb3-b3b47c895f3b.webp?v=1752650484","width":2000},{"alt":null,"id":25830060228707,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e420208f2209603a339fcc5739ef9fa90b0142d_e3dc9fab-b405-48c3-b95e-ffd9fa59912b.webp?v=1752650484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e420208f2209603a339fcc5739ef9fa90b0142d_e3dc9fab-b405-48c3-b95e-ffd9fa59912b.webp?v=1752650484","width":2000},{"alt":null,"id":25830060752995,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485","width":2000},{"alt":null,"id":25830061277283,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0cd2e7fca4606f4d23700fc588cadc31322c354f_f9e8d82c-f055-47ef-8625-c01286a5c71c.webp?v=1752650486"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0cd2e7fca4606f4d23700fc588cadc31322c354f_f9e8d82c-f055-47ef-8625-c01286a5c71c.webp?v=1752650486","width":2000},{"alt":null,"id":25830061768803,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/560f915d80286e5f5c564e783057996b39371f31_b00c8fd9-b912-4640-a018-1cb26d61fe75.webp?v=1752650486"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/560f915d80286e5f5c564e783057996b39371f31_b00c8fd9-b912-4640-a018-1cb26d61fe75.webp?v=1752650486","width":2000},{"alt":null,"id":25830062227555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6472a083402e3968e96a858d8e10ac041301ba7f_e5925555-0bcb-4bd2-b149-7b4c2e10cf01.webp?v=1752650487"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6472a083402e3968e96a858d8e10ac041301ba7f_e5925555-0bcb-4bd2-b149-7b4c2e10cf01.webp?v=1752650487","width":2000},{"alt":null,"id":25830062522467,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d227beaf7eb4101d30480e556f1bdb58dbf2b0b4_4711da64-f7ee-4416-a6b9-d6fb02318c6c.webp?v=1752650487"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d227beaf7eb4101d30480e556f1bdb58dbf2b0b4_4711da64-f7ee-4416-a6b9-d6fb02318c6c.webp?v=1752650487","width":2000},{"alt":null,"id":25830062850147,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488","width":2000},{"alt":null,"id":25830063046755,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43304282783843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712044131,"product_id":7769861193827,"position":12,"created_at":"2025-07-16T15:21:26+08:00","updated_at":"2025-07-16T15:21:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488","variant_ids":[43304282783843]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830062850147,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304287764579,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712339043,"product_id":7769861193827,"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\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489","variant_ids":[43304287764579]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830063046755,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/992527f26d387c4326ced70cadf6bb35b6ede254_ce0bbc84-1b9e-49d7-9fcc-0f86871a9fb9.webp?v=1752650489"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304287928419,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197709258851,"product_id":7769861193827,"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\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485","variant_ids":[43304287928419]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830060752995,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/094c9ba4a98c299da99c24e95256051152ab8802_ec250e20-9ceb-4b2a-8f94-b1b07c7ffb65.webp?v=1752650485"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43304282783843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34197712044131,"product_id":7769861193827,"position":12,"created_at":"2025-07-16T15:21:26+08:00","updated_at":"2025-07-16T15:21:28+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488","variant_ids":[43304282783843]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25830062850147,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e743635e30102c7ae75f64bba9f534ebe6b9060a_614928fe-981e-47bc-ba2c-102e33c572ee.webp?v=1752650488"}},"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: "停產"
}