$product = {"id":7937541242979,"title":"iPhone 12 mini Mod NX Jin Young Choi 轉轉貓","handle":"iphone-12-mini-mod-nx-cjy06","description":null,"published_at":"2025-12-12T09:53:08+08:00","created_at":"2025-12-11T09:41:17+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-jychoioioi","device-iPhone 12 Mini","merge","reseller-jychoioioi"],"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":43882906320995,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY06","requires_shipping":true,"taxable":true,"featured_image":{"id":34931772686435,"product_id":7937541242979,"position":21,"created_at":"2025-12-11T10:25:36+08:00","updated_at":"2025-12-11T10:25:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938","variant_ids":[43882906320995]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 轉轉貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY06","featured_media":{"alt":null,"id":26494146936931,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c.webp?v=1765417283","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce.webp?v=1765417283","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8.webp?v=1765417284","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8.webp?v=1765417285","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5.webp?v=1765417285","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87.webp?v=1765417285","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065.webp?v=1765417286","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46.webp?v=1765417287","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d.webp?v=1765417287","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa.webp?v=1765417288","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb.webp?v=1765417289","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce_ddba9a4a-d38c-4b90-9951-b862877d0515.webp?v=1765419933","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87_baf9b817-ad55-4c9e-a3cb-63452015ca0a.webp?v=1765419934","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa_afb588d3-9397-41a7-8671-410627e6afbf.webp?v=1765419935","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5_ca7364cc-66fb-4d85-9f09-21aadf536287.webp?v=1765419935","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8_c989b9be-4adf-4e34-a330-278131ee0cd0.webp?v=1765419936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c_32185ece-e175-478a-a4a3-2e6713137ccb.webp?v=1765419936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb_10deddbc-02b5-47ac-94cc-59a5338c6431.webp?v=1765419936","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8_e9662bf4-2064-48d1-8bdf-355c3201f0e4.webp?v=1765419937","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d_77c56df4-bb7b-4991-97dc-389415201521.webp?v=1765419938","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065_50ff8d26-06de-4391-8f4e-7ed82e833bd8.webp?v=1765419939"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c.webp?v=1765417283","options":["color"],"media":[{"alt":null,"id":26493142597731,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c.webp?v=1765417283"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c.webp?v=1765417283","width":2000},{"alt":null,"id":26493142696035,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce.webp?v=1765417283"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce.webp?v=1765417283","width":2000},{"alt":null,"id":26493142859875,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8.webp?v=1765417284"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8.webp?v=1765417284","width":2000},{"alt":null,"id":26493143023715,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8.webp?v=1765417285"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8.webp?v=1765417285","width":2000},{"alt":null,"id":26493143220323,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5.webp?v=1765417285"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5.webp?v=1765417285","width":2000},{"alt":null,"id":26493143580771,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87.webp?v=1765417285"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87.webp?v=1765417285","width":2000},{"alt":null,"id":26493143842915,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065.webp?v=1765417286"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065.webp?v=1765417286","width":2000},{"alt":null,"id":26493144006755,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46.webp?v=1765417287"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46.webp?v=1765417287","width":2000},{"alt":null,"id":26493144268899,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d.webp?v=1765417287"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d.webp?v=1765417287","width":2000},{"alt":null,"id":26493144957027,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa.webp?v=1765417288"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa.webp?v=1765417288","width":2000},{"alt":null,"id":26493145120867,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb.webp?v=1765417289"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb.webp?v=1765417289","width":2000},{"alt":null,"id":26494145265763,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce_ddba9a4a-d38c-4b90-9951-b862877d0515.webp?v=1765419933"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c61411d015f394e9f5371f7d30f2998cabef56ce_ddba9a4a-d38c-4b90-9951-b862877d0515.webp?v=1765419933","width":2000},{"alt":null,"id":26494145495139,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87_baf9b817-ad55-4c9e-a3cb-63452015ca0a.webp?v=1765419934"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8e35410a927936a95454d3fc5f1c627eabd6bd87_baf9b817-ad55-4c9e-a3cb-63452015ca0a.webp?v=1765419934","width":2000},{"alt":null,"id":26494145691747,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa_afb588d3-9397-41a7-8671-410627e6afbf.webp?v=1765419935"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a5d6b70eb468ce59990241ed4b575c191fa4b6fa_afb588d3-9397-41a7-8671-410627e6afbf.webp?v=1765419935","width":2000},{"alt":null,"id":26494145855587,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5_ca7364cc-66fb-4d85-9f09-21aadf536287.webp?v=1765419935"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/51dafa1cdc3c443e441812de09aa201c7985e1d5_ca7364cc-66fb-4d85-9f09-21aadf536287.webp?v=1765419935","width":2000},{"alt":null,"id":26494145986659,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8_c989b9be-4adf-4e34-a330-278131ee0cd0.webp?v=1765419936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3697d595762fa83470023aaee2d58b55454eced8_c989b9be-4adf-4e34-a330-278131ee0cd0.webp?v=1765419936","width":2000},{"alt":null,"id":26494146084963,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c_32185ece-e175-478a-a4a3-2e6713137ccb.webp?v=1765419936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f0c40f324794206984894b94da5324ed043bb74c_32185ece-e175-478a-a4a3-2e6713137ccb.webp?v=1765419936","width":2000},{"alt":null,"id":26494146248803,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb_10deddbc-02b5-47ac-94cc-59a5338c6431.webp?v=1765419936"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3bb3acd433a9a697e43432ba8217142286a66ecb_10deddbc-02b5-47ac-94cc-59a5338c6431.webp?v=1765419936","width":2000},{"alt":null,"id":26494146445411,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8_e9662bf4-2064-48d1-8bdf-355c3201f0e4.webp?v=1765419937"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6fc0dfd5c9d8fc7a0cce1840a9058f6e9e6ed3c8_e9662bf4-2064-48d1-8bdf-355c3201f0e4.webp?v=1765419937","width":2000},{"alt":null,"id":26494146674787,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d_77c56df4-bb7b-4991-97dc-389415201521.webp?v=1765419938"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7c0e861781b4e3fd1d8fe71e9472ca1d2990b10d_77c56df4-bb7b-4991-97dc-389415201521.webp?v=1765419938","width":2000},{"alt":null,"id":26494146936931,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938","width":2000},{"alt":null,"id":26494147166307,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065_50ff8d26-06de-4391-8f4e-7ed82e833bd8.webp?v=1765419939"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b2c53555bcc2beb5f17bdafdfa591cacbd3e7065_50ff8d26-06de-4391-8f4e-7ed82e833bd8.webp?v=1765419939","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43882906320995,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY06","requires_shipping":true,"taxable":true,"featured_image":{"id":34931772686435,"product_id":7937541242979,"position":21,"created_at":"2025-12-11T10:25:36+08:00","updated_at":"2025-12-11T10:25:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938","variant_ids":[43882906320995]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 轉轉貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY06","featured_media":{"alt":null,"id":26494146936931,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43882906320995,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY06","requires_shipping":true,"taxable":true,"featured_image":{"id":34931772686435,"product_id":7937541242979,"position":21,"created_at":"2025-12-11T10:25:36+08:00","updated_at":"2025-12-11T10:25:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938","variant_ids":[43882906320995]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 轉轉貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY06","featured_media":{"alt":null,"id":26494146936931,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e1e7ecacce635afe0d6b437ac5487340c6799e46_e215f545-9169-4522-91bb-e1f2477a9e34.webp?v=1765419938"}},"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: "停產"
}