$product = {"id":7920328605795,"title":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers","handle":"iphone-17-mod-nx-with-capture-button-ltc08","description":null,"published_at":"2025-11-11T09:30:52+08:00","created_at":"2025-11-10T11:01:13+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-littlecattos","device-iPhone 17","merge","reseller-littlecattos"],"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":43828222591075,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NXB01350C1-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640739427,"product_id":7920328605795,"position":4,"created_at":"2025-11-10T11:01:17+08:00","updated_at":"2025-11-10T11:01:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679","variant_ids":[43828222591075]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB01350C1-LTC08","featured_media":{"alt":null,"id":26346777018467,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224098403,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NXB01350J5-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780639985763,"product_id":7920328605795,"position":1,"created_at":"2025-11-10T11:01:14+08:00","updated_at":"2025-11-10T11:01:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676","variant_ids":[43828224098403]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - 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":"NXB01350J5-LTC08","featured_media":{"alt":null,"id":26346776264803,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224131171,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NXB0135004-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640247907,"product_id":7920328605795,"position":2,"created_at":"2025-11-10T11:01:15+08:00","updated_at":"2025-11-10T11:01:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677","variant_ids":[43828224131171]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135004-LTC08","featured_media":{"alt":null,"id":26346776526947,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224163939,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NXB0135015-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640903267,"product_id":7920328605795,"position":5,"created_at":"2025-11-10T11:01:18+08:00","updated_at":"2025-11-10T11:01:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679","variant_ids":[43828224163939]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135015-LTC08","featured_media":{"alt":null,"id":26346777280611,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224196707,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NXB0135069-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640477283,"product_id":7920328605795,"position":3,"created_at":"2025-11-10T11:01:16+08:00","updated_at":"2025-11-10T11:01:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678","variant_ids":[43828224196707]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135069-LTC08","featured_media":{"alt":null,"id":26346776756323,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224229475,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NXB0135024-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780641591395,"product_id":7920328605795,"position":6,"created_at":"2025-11-10T11:01:18+08:00","updated_at":"2025-11-10T11:01:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681","variant_ids":[43828224229475]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135024-LTC08","featured_media":{"alt":null,"id":26346777968739,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676","options":["color"],"media":[{"alt":null,"id":26346776264803,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676","width":2000},{"alt":null,"id":26346776526947,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677","width":2000},{"alt":null,"id":26346776756323,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678","width":2000},{"alt":null,"id":26346777018467,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679","width":2000},{"alt":null,"id":26346777280611,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679","width":2000},{"alt":null,"id":26346777968739,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43828222591075,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NXB01350C1-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640739427,"product_id":7920328605795,"position":4,"created_at":"2025-11-10T11:01:17+08:00","updated_at":"2025-11-10T11:01:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679","variant_ids":[43828222591075]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB01350C1-LTC08","featured_media":{"alt":null,"id":26346777018467,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224098403,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NXB01350J5-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780639985763,"product_id":7920328605795,"position":1,"created_at":"2025-11-10T11:01:14+08:00","updated_at":"2025-11-10T11:01:16+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676","variant_ids":[43828224098403]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - 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":"NXB01350J5-LTC08","featured_media":{"alt":null,"id":26346776264803,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8eb994d827be33373b5156bd9b95654442c35df9.webp?v=1762743676"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224131171,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NXB0135004-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640247907,"product_id":7920328605795,"position":2,"created_at":"2025-11-10T11:01:15+08:00","updated_at":"2025-11-10T11:01:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677","variant_ids":[43828224131171]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135004-LTC08","featured_media":{"alt":null,"id":26346776526947,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/790514a7d31ae4de316e288ae3027afcff88961a.webp?v=1762743677"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224163939,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NXB0135015-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640903267,"product_id":7920328605795,"position":5,"created_at":"2025-11-10T11:01:18+08:00","updated_at":"2025-11-10T11:01:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679","variant_ids":[43828224163939]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135015-LTC08","featured_media":{"alt":null,"id":26346777280611,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6afcd7505c093d01cd4c4a397361be78e9366e7d.webp?v=1762743679"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224196707,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"NXB0135069-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640477283,"product_id":7920328605795,"position":3,"created_at":"2025-11-10T11:01:16+08:00","updated_at":"2025-11-10T11:01:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678","variant_ids":[43828224196707]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Graphite","public_title":"Graphite","options":["Graphite"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135069-LTC08","featured_media":{"alt":null,"id":26346776756323,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de08ca353f580025abe9546a7fdd3551a9cda233.webp?v=1762743678"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43828224229475,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NXB0135024-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780641591395,"product_id":7920328605795,"position":6,"created_at":"2025-11-10T11:01:18+08:00","updated_at":"2025-11-10T11:01:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681","variant_ids":[43828224229475]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB0135024-LTC08","featured_media":{"alt":null,"id":26346777968739,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3a68b1117ff3c328b8b77c44535979a8a74af9a.webp?v=1762743681"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43828222591075,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NXB01350C1-LTC08","requires_shipping":true,"taxable":true,"featured_image":{"id":34780640739427,"product_id":7920328605795,"position":4,"created_at":"2025-11-10T11:01:17+08:00","updated_at":"2025-11-10T11:01:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679","variant_ids":[43828222591075]},"available":true,"name":"iPhone 17 Mod NX -邊框背蓋組合 (相機按鈕) 小貓貓們 Little Cattos Sunflowers - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NXB01350C1-LTC08","featured_media":{"alt":null,"id":26346777018467,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4513155250b484baa1f3fc21fb98e34244e97f87.webp?v=1762743679"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null
var sellingStatus
if ($bumper) {
$(document).ready(function() {
var productImg = $product.images[0]
var bumperVariants = $bumper.variants;
var bumperColors = new Object();
var currentVariant = '';
var productType = '';
bumperVariants.forEach(variant => {
bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src;
});
if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') {
mergeImages(
[productImg, bumperColors[currentVariant]],
{ crossOrigin: 'anonymous' }
).then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
} else {
mergeImages(
[bumperColors[currentVariant], productImg],
{ crossOrigin: 'anonymous' }
).then(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: "停產"
}