$product = {"id":7769544589411,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf46","description":null,"published_at":"2025-07-16T17:25:19+08:00","created_at":"2025-04-15T17:32:58+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":43302850560099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721743459,"product_id":7769544589411,"position":13,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497","variant_ids":[43302850560099]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830067175523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302857113699,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197713223779,"product_id":7769544589411,"position":2,"created_at":"2025-07-16T15:21:29+08:00","updated_at":"2025-07-16T15:21:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491","variant_ids":[43302857113699]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830063276131,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302857277539,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197718827107,"product_id":7769544589411,"position":10,"created_at":"2025-07-16T15:21:33+08:00","updated_at":"2025-07-16T15:21:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495","variant_ids":[43302857277539]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830065766499,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d5799a17c5b3d544664bd1e7756add6c6c5bbe2.webp?v=1744709586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14ae5a648fc229abf68ba8cfb70986530448f5f7_5ccd41a0-76d7-4f24-be1f-5e6abbd66c76.webp?v=1752650491","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b8f2e5394e3efb641fc6896544bf2be5f1ab235_f597a632-1bc0-44cf-9e01-8fd426fdac56.webp?v=1752650492","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bc10a5b673af805fc4080418106a2e07ff7bb5a_51293327-0663-4790-ab9f-55f0adbd9a10.webp?v=1752650493","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/393540d963f1b1eca594728ec65734a43012f19b_9ff6a3e6-fd41-4e53-8bce-84e64374bdf2.webp?v=1752650493","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57dbcc23cb749f063001a93dc246d2b942b1466a_eb7e0603-29b6-4e5b-a5ac-0d37d4861924.webp?v=1752650494","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36766559a462ff51ef327adf04c3346cca2c0d52_de3d27c8-cede-40e9-bcec-6a81c99eb23d.webp?v=1752650494","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28264eb18c964bcf61f38c283a24f3c1e2e87c6c_3d357b13-2ce9-4983-aaf3-2c1660cb76f8.webp?v=1752650495","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32033a27048b5f651c0ee5e5cb3413f5977eb7c6_6d39da73-fb2f-4294-9fdc-d100e99e8329.webp?v=1752650496","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fed19636b4f559a9e518335b35af69d6d45961f_8d0f8a1d-5239-43d0-8f8b-0a839a6562ce.webp?v=1752650497","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d5799a17c5b3d544664bd1e7756add6c6c5bbe2.webp?v=1744709586","options":["color"],"media":[{"alt":null,"id":25495761616995,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d5799a17c5b3d544664bd1e7756add6c6c5bbe2.webp?v=1744709586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9d5799a17c5b3d544664bd1e7756add6c6c5bbe2.webp?v=1744709586","width":2000},{"alt":null,"id":25830063276131,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491","width":2000},{"alt":null,"id":25830063407203,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14ae5a648fc229abf68ba8cfb70986530448f5f7_5ccd41a0-76d7-4f24-be1f-5e6abbd66c76.webp?v=1752650491"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14ae5a648fc229abf68ba8cfb70986530448f5f7_5ccd41a0-76d7-4f24-be1f-5e6abbd66c76.webp?v=1752650491","width":2000},{"alt":null,"id":25830063734883,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b8f2e5394e3efb641fc6896544bf2be5f1ab235_f597a632-1bc0-44cf-9e01-8fd426fdac56.webp?v=1752650492"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9b8f2e5394e3efb641fc6896544bf2be5f1ab235_f597a632-1bc0-44cf-9e01-8fd426fdac56.webp?v=1752650492","width":2000},{"alt":null,"id":25830063898723,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bc10a5b673af805fc4080418106a2e07ff7bb5a_51293327-0663-4790-ab9f-55f0adbd9a10.webp?v=1752650493"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bc10a5b673af805fc4080418106a2e07ff7bb5a_51293327-0663-4790-ab9f-55f0adbd9a10.webp?v=1752650493","width":2000},{"alt":null,"id":25830064095331,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/393540d963f1b1eca594728ec65734a43012f19b_9ff6a3e6-fd41-4e53-8bce-84e64374bdf2.webp?v=1752650493"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/393540d963f1b1eca594728ec65734a43012f19b_9ff6a3e6-fd41-4e53-8bce-84e64374bdf2.webp?v=1752650493","width":2000},{"alt":null,"id":25830064357475,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57dbcc23cb749f063001a93dc246d2b942b1466a_eb7e0603-29b6-4e5b-a5ac-0d37d4861924.webp?v=1752650494"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57dbcc23cb749f063001a93dc246d2b942b1466a_eb7e0603-29b6-4e5b-a5ac-0d37d4861924.webp?v=1752650494","width":2000},{"alt":null,"id":25830064685155,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36766559a462ff51ef327adf04c3346cca2c0d52_de3d27c8-cede-40e9-bcec-6a81c99eb23d.webp?v=1752650494"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/36766559a462ff51ef327adf04c3346cca2c0d52_de3d27c8-cede-40e9-bcec-6a81c99eb23d.webp?v=1752650494","width":2000},{"alt":null,"id":25830064980067,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28264eb18c964bcf61f38c283a24f3c1e2e87c6c_3d357b13-2ce9-4983-aaf3-2c1660cb76f8.webp?v=1752650495"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/28264eb18c964bcf61f38c283a24f3c1e2e87c6c_3d357b13-2ce9-4983-aaf3-2c1660cb76f8.webp?v=1752650495","width":2000},{"alt":null,"id":25830065766499,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495","width":2000},{"alt":null,"id":25830066290787,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32033a27048b5f651c0ee5e5cb3413f5977eb7c6_6d39da73-fb2f-4294-9fdc-d100e99e8329.webp?v=1752650496"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32033a27048b5f651c0ee5e5cb3413f5977eb7c6_6d39da73-fb2f-4294-9fdc-d100e99e8329.webp?v=1752650496","width":2000},{"alt":null,"id":25830066782307,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fed19636b4f559a9e518335b35af69d6d45961f_8d0f8a1d-5239-43d0-8f8b-0a839a6562ce.webp?v=1752650497"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fed19636b4f559a9e518335b35af69d6d45961f_8d0f8a1d-5239-43d0-8f8b-0a839a6562ce.webp?v=1752650497","width":2000},{"alt":null,"id":25830067175523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43302850560099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721743459,"product_id":7769544589411,"position":13,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497","variant_ids":[43302850560099]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830067175523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302857113699,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197713223779,"product_id":7769544589411,"position":2,"created_at":"2025-07-16T15:21:29+08:00","updated_at":"2025-07-16T15:21:31+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491","variant_ids":[43302857113699]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830063276131,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ffb1d606dc6e5cc909aa8d1ce229cdf5ba4a5084_8afc47f9-141d-4a2e-9a79-6df5abaf0dd4.webp?v=1752650491"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302857277539,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197718827107,"product_id":7769544589411,"position":10,"created_at":"2025-07-16T15:21:33+08:00","updated_at":"2025-07-16T15:21:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495","variant_ids":[43302857277539]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830065766499,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd0fe2e791e897799587ede7b981e53bb63e71d7_41ef9084-933c-4d8e-91bd-5ac641de427b.webp?v=1752650495"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43302850560099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF46","requires_shipping":true,"taxable":true,"featured_image":{"id":34197721743459,"product_id":7769544589411,"position":13,"created_at":"2025-07-16T15:21:35+08:00","updated_at":"2025-07-16T15:21:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497","variant_ids":[43302850560099]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - 冷靜 - 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-XF46","featured_media":{"alt":null,"id":25830067175523,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3d2b331a563a83c6c9eb1729e5a5ca736c726481_36b08110-31fa-41c1-8bad-dfe4e45d7388.webp?v=1752650497"}},"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: "停產"
}