$product = {"id":7769641910371,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and Cat - 太陽與貓","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf52","description":null,"published_at":"2025-07-16T17:14:58+08:00","created_at":"2025-04-15T18:50:02+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":43303302430819,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197755953251,"product_id":7769641910371,"position":12,"created_at":"2025-07-16T15:22:07+08:00","updated_at":"2025-07-16T15:22:08+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528","variant_ids":[43303302430819]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830085984355,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303307870307,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197748777059,"product_id":7769641910371,"position":2,"created_at":"2025-07-16T15:22:01+08:00","updated_at":"2025-07-16T15:22:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523","variant_ids":[43303307870307]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830081757283,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303308034147,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197751758947,"product_id":7769641910371,"position":6,"created_at":"2025-07-16T15:22:03+08:00","updated_at":"2025-07-16T15:22:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525","variant_ids":[43303308034147]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830083297379,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4efc1606dd9882be71f7382b6437279a69aaf063_f98faf79-e969-4994-9319-f0944fac4c23.webp?v=1744714208","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eb27e7548a87fd15a3e7a6ad9802d86713cd8dc_83d7f1aa-3ab2-4139-8234-b1fc35e402b1.webp?v=1752650523","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2fe93e1fe5464f9359ca2e9f6804adbd32fd19d_bfbc623f-8b0c-44ec-879d-d4a464c934d0.webp?v=1752650524","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae688af60a941cabd83527c37ed160b2e70df7e6_f9e1e057-cdd5-4ad4-9e69-8ebb58a1b242.webp?v=1752650524","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c90f30d34906920264442e564dbe9cd7f6738e_b5daeb41-32c8-4969-9194-e0c8130fc9c4.webp?v=1752650525","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc5b9b13d5cf38ad87851ad5b7069c0941e0b612_f9019fe1-a634-45a8-9292-05d28d8f4115.webp?v=1752650526","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66d952018f8a3ac23574e86ce472376c6b54125_4c1710fd-a114-485e-8d74-18fb91d90311.webp?v=1752650527","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9fdfcbf4138dc6bc5368045c0d6abb1ed1f1f9e1_0dddfb11-7651-43c1-8372-04fec2f1eaae.webp?v=1752650527","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a65f2a5cac75fe41e800b1a4273323affdf631c0_3e3fd872-5e12-4b01-8f10-3b2a9d2b05b5.webp?v=1752650528","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59cdf704464d95b8bfcceb02b72d785a889f8824_134db213-38f0-4e6c-afd1-6d94c077eb85.webp?v=1752650529"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4efc1606dd9882be71f7382b6437279a69aaf063_f98faf79-e969-4994-9319-f0944fac4c23.webp?v=1744714208","options":["color"],"media":[{"alt":null,"id":25496036180067,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4efc1606dd9882be71f7382b6437279a69aaf063_f98faf79-e969-4994-9319-f0944fac4c23.webp?v=1744714208"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4efc1606dd9882be71f7382b6437279a69aaf063_f98faf79-e969-4994-9319-f0944fac4c23.webp?v=1744714208","width":2000},{"alt":null,"id":25830081757283,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523","width":2000},{"alt":null,"id":25830082084963,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eb27e7548a87fd15a3e7a6ad9802d86713cd8dc_83d7f1aa-3ab2-4139-8234-b1fc35e402b1.webp?v=1752650523"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eb27e7548a87fd15a3e7a6ad9802d86713cd8dc_83d7f1aa-3ab2-4139-8234-b1fc35e402b1.webp?v=1752650523","width":2000},{"alt":null,"id":25830082412643,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2fe93e1fe5464f9359ca2e9f6804adbd32fd19d_bfbc623f-8b0c-44ec-879d-d4a464c934d0.webp?v=1752650524"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2fe93e1fe5464f9359ca2e9f6804adbd32fd19d_bfbc623f-8b0c-44ec-879d-d4a464c934d0.webp?v=1752650524","width":2000},{"alt":null,"id":25830082773091,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae688af60a941cabd83527c37ed160b2e70df7e6_f9e1e057-cdd5-4ad4-9e69-8ebb58a1b242.webp?v=1752650524"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ae688af60a941cabd83527c37ed160b2e70df7e6_f9e1e057-cdd5-4ad4-9e69-8ebb58a1b242.webp?v=1752650524","width":2000},{"alt":null,"id":25830083297379,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525","width":2000},{"alt":null,"id":25830083625059,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c90f30d34906920264442e564dbe9cd7f6738e_b5daeb41-32c8-4969-9194-e0c8130fc9c4.webp?v=1752650525"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9c90f30d34906920264442e564dbe9cd7f6738e_b5daeb41-32c8-4969-9194-e0c8130fc9c4.webp?v=1752650525","width":2000},{"alt":null,"id":25830084313187,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc5b9b13d5cf38ad87851ad5b7069c0941e0b612_f9019fe1-a634-45a8-9292-05d28d8f4115.webp?v=1752650526"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dc5b9b13d5cf38ad87851ad5b7069c0941e0b612_f9019fe1-a634-45a8-9292-05d28d8f4115.webp?v=1752650526","width":2000},{"alt":null,"id":25830084706403,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66d952018f8a3ac23574e86ce472376c6b54125_4c1710fd-a114-485e-8d74-18fb91d90311.webp?v=1752650527"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f66d952018f8a3ac23574e86ce472376c6b54125_4c1710fd-a114-485e-8d74-18fb91d90311.webp?v=1752650527","width":2000},{"alt":null,"id":25830085066851,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9fdfcbf4138dc6bc5368045c0d6abb1ed1f1f9e1_0dddfb11-7651-43c1-8372-04fec2f1eaae.webp?v=1752650527"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9fdfcbf4138dc6bc5368045c0d6abb1ed1f1f9e1_0dddfb11-7651-43c1-8372-04fec2f1eaae.webp?v=1752650527","width":2000},{"alt":null,"id":25830085656675,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a65f2a5cac75fe41e800b1a4273323affdf631c0_3e3fd872-5e12-4b01-8f10-3b2a9d2b05b5.webp?v=1752650528"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a65f2a5cac75fe41e800b1a4273323affdf631c0_3e3fd872-5e12-4b01-8f10-3b2a9d2b05b5.webp?v=1752650528","width":2000},{"alt":null,"id":25830085984355,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528","width":2000},{"alt":null,"id":25830086246499,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59cdf704464d95b8bfcceb02b72d785a889f8824_134db213-38f0-4e6c-afd1-6d94c077eb85.webp?v=1752650529"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/59cdf704464d95b8bfcceb02b72d785a889f8824_134db213-38f0-4e6c-afd1-6d94c077eb85.webp?v=1752650529","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43303302430819,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197755953251,"product_id":7769641910371,"position":12,"created_at":"2025-07-16T15:22:07+08:00","updated_at":"2025-07-16T15:22:08+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528","variant_ids":[43303302430819]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830085984355,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303307870307,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197748777059,"product_id":7769641910371,"position":2,"created_at":"2025-07-16T15:22:01+08:00","updated_at":"2025-07-16T15:22:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523","variant_ids":[43303307870307]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830081757283,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f290a2e4d77ebaa7f662393f8137fe0f9d265a2d_b83d6c70-cf02-4247-a787-2b9307d21fbc.webp?v=1752650523"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303308034147,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197751758947,"product_id":7769641910371,"position":6,"created_at":"2025-07-16T15:22:03+08:00","updated_at":"2025-07-16T15:22:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525","variant_ids":[43303308034147]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830083297379,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c01f72f583a413607014235cc6aa307fad6efbe9_776384a6-79a8-4725-bde6-0503bd849ecb.webp?v=1752650525"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43303302430819,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF52","requires_shipping":true,"taxable":true,"featured_image":{"id":34197755953251,"product_id":7769641910371,"position":12,"created_at":"2025-07-16T15:22:07+08:00","updated_at":"2025-07-16T15:22:08+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528","variant_ids":[43303302430819]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle The Sun and 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-XF52","featured_media":{"alt":null,"id":25830085984355,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9f28637d3f2431634ac17289f178d0055891790a_9387ee0d-7127-4115-bf93-6c4e85068967.webp?v=1752650528"}},"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: "停產"
}