$product = {"id":7769923846243,"title":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓","handle":"iphone-14-pro-mod-nx-printable-xf48","description":null,"published_at":"2025-04-16T13:29:59+08:00","created_at":"2025-04-15T22:10:25+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX專區-I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone 14 Pro","merge","reseller-ilovedoodle"],"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":43304618164323,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196921712739,"product_id":7769923846243,"position":11,"created_at":"2025-07-16T14:54:20+08:00","updated_at":"2025-07-16T14:54:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862","variant_ids":[43304618164323]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF48","featured_media":{"alt":null,"id":25829617500259,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304624717923,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196918567011,"product_id":7769923846243,"position":4,"created_at":"2025-07-16T14:54:16+08:00","updated_at":"2025-07-16T14:54:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858","variant_ids":[43304624717923]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF48","featured_media":{"alt":null,"id":25829615960163,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304624881763,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196919189603,"product_id":7769923846243,"position":5,"created_at":"2025-07-16T14:54:17+08:00","updated_at":"2025-07-16T14:54:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859","variant_ids":[43304624881763]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - 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":"NPB01262J5-XF48","featured_media":{"alt":null,"id":25829616058467,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c88792cf81dfdf04ea340093e4a32401ffa4afe_5d9aa72b-8b9e-4b14-a86c-6662f442fa82.webp?v=1744726231","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a722a49c747fddb9fb23cb9dfba719ddc945e50a_269ee9fc-a828-4e33-afff-5824e19ed4b2.webp?v=1752648857","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/851ca25ca5a97043653ea0f587e58aa9d5e45a22_0c2942b5-edfb-4da3-a0c2-fd99aabc620c.webp?v=1752648857","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/47f530cef487e921015614645a1c07db46ad8434_b6c25ab6-cc4e-49d1-bc39-3cb9d6c18eba.webp?v=1752648859","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6e29e49675afa9f6729fbb96d0a591fa8e96f13f_f0e64de2-c3bd-4bda-b4fc-60096ee068db.webp?v=1752648860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf17bfba1d340474e73031af17a583fd50c6af15_f196854a-9fba-458a-8105-1787aa68f7e2.webp?v=1752648860","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3651064bf0716366b4c7a640c879ffb55f1c0f6_8c1a92b3-3278-48f5-ab54-a851d1849eb1.webp?v=1752648861","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/137cfbf50cf3393293b9a1202832653be39a4225_b2fce365-b195-4f66-8686-a4a0dcfc0619.webp?v=1752648861","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2244cd279de1033a47bb7640c1babae535ac3d34_28aab2ad-c400-48d5-aef8-0f3626ff96d7.webp?v=1752648863","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/996e746a0d7c800c21fe04179d1c6a30ce3016a8_c5bff66d-d3fc-4960-9b0e-cb0a44b5ea0f.webp?v=1752648863"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c88792cf81dfdf04ea340093e4a32401ffa4afe_5d9aa72b-8b9e-4b14-a86c-6662f442fa82.webp?v=1744726231","options":["color"],"media":[{"alt":null,"id":25496523243619,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c88792cf81dfdf04ea340093e4a32401ffa4afe_5d9aa72b-8b9e-4b14-a86c-6662f442fa82.webp?v=1744726231"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1c88792cf81dfdf04ea340093e4a32401ffa4afe_5d9aa72b-8b9e-4b14-a86c-6662f442fa82.webp?v=1744726231","width":2000},{"alt":null,"id":25829615534179,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a722a49c747fddb9fb23cb9dfba719ddc945e50a_269ee9fc-a828-4e33-afff-5824e19ed4b2.webp?v=1752648857"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a722a49c747fddb9fb23cb9dfba719ddc945e50a_269ee9fc-a828-4e33-afff-5824e19ed4b2.webp?v=1752648857","width":2000},{"alt":null,"id":25829615730787,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/851ca25ca5a97043653ea0f587e58aa9d5e45a22_0c2942b5-edfb-4da3-a0c2-fd99aabc620c.webp?v=1752648857"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/851ca25ca5a97043653ea0f587e58aa9d5e45a22_0c2942b5-edfb-4da3-a0c2-fd99aabc620c.webp?v=1752648857","width":2000},{"alt":null,"id":25829615960163,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858","width":2000},{"alt":null,"id":25829616058467,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859","width":2000},{"alt":null,"id":25829616222307,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/47f530cef487e921015614645a1c07db46ad8434_b6c25ab6-cc4e-49d1-bc39-3cb9d6c18eba.webp?v=1752648859"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/47f530cef487e921015614645a1c07db46ad8434_b6c25ab6-cc4e-49d1-bc39-3cb9d6c18eba.webp?v=1752648859","width":2000},{"alt":null,"id":25829616320611,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6e29e49675afa9f6729fbb96d0a591fa8e96f13f_f0e64de2-c3bd-4bda-b4fc-60096ee068db.webp?v=1752648860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6e29e49675afa9f6729fbb96d0a591fa8e96f13f_f0e64de2-c3bd-4bda-b4fc-60096ee068db.webp?v=1752648860","width":2000},{"alt":null,"id":25829616746595,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf17bfba1d340474e73031af17a583fd50c6af15_f196854a-9fba-458a-8105-1787aa68f7e2.webp?v=1752648860"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf17bfba1d340474e73031af17a583fd50c6af15_f196854a-9fba-458a-8105-1787aa68f7e2.webp?v=1752648860","width":2000},{"alt":null,"id":25829617074275,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3651064bf0716366b4c7a640c879ffb55f1c0f6_8c1a92b3-3278-48f5-ab54-a851d1849eb1.webp?v=1752648861"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3651064bf0716366b4c7a640c879ffb55f1c0f6_8c1a92b3-3278-48f5-ab54-a851d1849eb1.webp?v=1752648861","width":2000},{"alt":null,"id":25829617238115,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/137cfbf50cf3393293b9a1202832653be39a4225_b2fce365-b195-4f66-8686-a4a0dcfc0619.webp?v=1752648861"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/137cfbf50cf3393293b9a1202832653be39a4225_b2fce365-b195-4f66-8686-a4a0dcfc0619.webp?v=1752648861","width":2000},{"alt":null,"id":25829617500259,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862","width":2000},{"alt":null,"id":25829618024547,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2244cd279de1033a47bb7640c1babae535ac3d34_28aab2ad-c400-48d5-aef8-0f3626ff96d7.webp?v=1752648863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2244cd279de1033a47bb7640c1babae535ac3d34_28aab2ad-c400-48d5-aef8-0f3626ff96d7.webp?v=1752648863","width":2000},{"alt":null,"id":25829618188387,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/996e746a0d7c800c21fe04179d1c6a30ce3016a8_c5bff66d-d3fc-4960-9b0e-cb0a44b5ea0f.webp?v=1752648863"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/996e746a0d7c800c21fe04179d1c6a30ce3016a8_c5bff66d-d3fc-4960-9b0e-cb0a44b5ea0f.webp?v=1752648863","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43304618164323,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196921712739,"product_id":7769923846243,"position":11,"created_at":"2025-07-16T14:54:20+08:00","updated_at":"2025-07-16T14:54:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862","variant_ids":[43304618164323]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF48","featured_media":{"alt":null,"id":25829617500259,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304624717923,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196918567011,"product_id":7769923846243,"position":4,"created_at":"2025-07-16T14:54:16+08:00","updated_at":"2025-07-16T14:54:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858","variant_ids":[43304624717923]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF48","featured_media":{"alt":null,"id":25829615960163,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c60239755e2c6373d6ce5d136f2913ea395d466e_545a6759-50a8-498e-bd80-2f3b4b77f9cd.webp?v=1752648858"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304624881763,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196919189603,"product_id":7769923846243,"position":5,"created_at":"2025-07-16T14:54:17+08:00","updated_at":"2025-07-16T14:54:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859","variant_ids":[43304624881763]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - 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":"NPB01262J5-XF48","featured_media":{"alt":null,"id":25829616058467,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e48a2ee30ef9bbc34fba43ad663cbc5bb94b660_4de918f5-cb1a-4102-ac81-e46c1a81e2e0.webp?v=1752648859"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43304618164323,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF48","requires_shipping":true,"taxable":true,"featured_image":{"id":34196921712739,"product_id":7769923846243,"position":11,"created_at":"2025-07-16T14:54:20+08:00","updated_at":"2025-07-16T14:54:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862","variant_ids":[43304618164323]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Peek A Paw - 躲貓貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF48","featured_media":{"alt":null,"id":25829617500259,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8817842623f1ab5224ad9007f339bc885af9885f_702bee25-d3ec-4a9c-aea2-1efe45c8dfe7.webp?v=1752648862"}},"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: "停產"
}