$product = {"id":7937816264803,"title":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人","handle":"iphone-15-pro-max-solidx-xu09","description":null,"published_at":"2025-12-12T10:54:56+08:00","created_at":"2025-12-11T15:33:34+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-attack-on-titan","device-iPhone 15 Pro Max","merge","reseller-attack-on-titan"],"price":125000,"price_min":125000,"price_max":125000,"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":43884005982307,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932650082403,"product_id":7937816264803,"position":3,"created_at":"2025-12-11T15:33:42+08:00","updated_at":"2025-12-11T15:33:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424","variant_ids":[43884005982307]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298O8-XU09","featured_media":{"alt":null,"id":26495021875299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006015075,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932651098211,"product_id":7937816264803,"position":6,"created_at":"2025-12-11T15:33:43+08:00","updated_at":"2025-12-11T15:33:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425","variant_ids":[43884006015075]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Blush Pink","public_title":"Blush Pink","options":["Blush Pink"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129857-XU09","featured_media":{"alt":null,"id":26495022891107,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006047843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932650475619,"product_id":7937816264803,"position":4,"created_at":"2025-12-11T15:33:42+08:00","updated_at":"2025-12-11T15:33:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424","variant_ids":[43884006047843]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129852-XU09","featured_media":{"alt":null,"id":26495022268515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006146147,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932652146787,"product_id":7937816264803,"position":10,"created_at":"2025-12-11T15:33:45+08:00","updated_at":"2025-12-11T15:33:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427","variant_ids":[43884006146147]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129853-XU09","featured_media":{"alt":null,"id":26495024103523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006178915,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932651950179,"product_id":7937816264803,"position":9,"created_at":"2025-12-11T15:33:45+08:00","updated_at":"2025-12-11T15:33:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427","variant_ids":[43884006178915]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298Z7-XU09","featured_media":{"alt":null,"id":26495023906915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0710296e181f7e063ccd8d3a77adc6df7637a82d.webp?v=1765438421","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6e16db1fab9fba3f328b8207bc96985b9eb91.webp?v=1765438421","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7f2928e4a894287206bc190da8effb48386b96.webp?v=1765438425","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b773c1b8b0265dabd8d1c6f9fb446d55d1a2bde.webp?v=1765438426","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e45eceefdd576ef2ad9298042aa0efba73a39655.webp?v=1765438427","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0710296e181f7e063ccd8d3a77adc6df7637a82d.webp?v=1765438421","options":["color"],"media":[{"alt":null,"id":26495021219939,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0710296e181f7e063ccd8d3a77adc6df7637a82d.webp?v=1765438421"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0710296e181f7e063ccd8d3a77adc6df7637a82d.webp?v=1765438421","width":2000},{"alt":null,"id":26495021416547,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6e16db1fab9fba3f328b8207bc96985b9eb91.webp?v=1765438421"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6e16db1fab9fba3f328b8207bc96985b9eb91.webp?v=1765438421","width":2000},{"alt":null,"id":26495021875299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424","width":2000},{"alt":null,"id":26495022268515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424","width":2000},{"alt":null,"id":26495022563427,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7f2928e4a894287206bc190da8effb48386b96.webp?v=1765438425"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a7f2928e4a894287206bc190da8effb48386b96.webp?v=1765438425","width":2000},{"alt":null,"id":26495022891107,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425","width":2000},{"alt":null,"id":26495023218787,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b773c1b8b0265dabd8d1c6f9fb446d55d1a2bde.webp?v=1765438426"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4b773c1b8b0265dabd8d1c6f9fb446d55d1a2bde.webp?v=1765438426","width":2000},{"alt":null,"id":26495023612003,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e45eceefdd576ef2ad9298042aa0efba73a39655.webp?v=1765438427"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e45eceefdd576ef2ad9298042aa0efba73a39655.webp?v=1765438427","width":2000},{"alt":null,"id":26495023906915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427","width":2000},{"alt":null,"id":26495024103523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43884005982307,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932650082403,"product_id":7937816264803,"position":3,"created_at":"2025-12-11T15:33:42+08:00","updated_at":"2025-12-11T15:33:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424","variant_ids":[43884005982307]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298O8-XU09","featured_media":{"alt":null,"id":26495021875299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006015075,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932651098211,"product_id":7937816264803,"position":6,"created_at":"2025-12-11T15:33:43+08:00","updated_at":"2025-12-11T15:33:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425","variant_ids":[43884006015075]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Blush Pink","public_title":"Blush Pink","options":["Blush Pink"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129857-XU09","featured_media":{"alt":null,"id":26495022891107,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27055693fe27ab30ad1e45af0a302706cd886f7f.webp?v=1765438425"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006047843,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932650475619,"product_id":7937816264803,"position":4,"created_at":"2025-12-11T15:33:42+08:00","updated_at":"2025-12-11T15:33:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424","variant_ids":[43884006047843]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129852-XU09","featured_media":{"alt":null,"id":26495022268515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e274caa2c93e437e6af4d18bbac5aa194e09066.webp?v=1765438424"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006146147,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932652146787,"product_id":7937816264803,"position":10,"created_at":"2025-12-11T15:33:45+08:00","updated_at":"2025-12-11T15:33:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427","variant_ids":[43884006146147]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129853-XU09","featured_media":{"alt":null,"id":26495024103523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b011a18ec5e18ff749e93082323b6b79d2cef033.webp?v=1765438427"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884006178915,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932651950179,"product_id":7937816264803,"position":9,"created_at":"2025-12-11T15:33:45+08:00","updated_at":"2025-12-11T15:33:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427","variant_ids":[43884006178915]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Glacier Blue","public_title":"Glacier Blue","options":["Glacier Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298Z7-XU09","featured_media":{"alt":null,"id":26495023906915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac1d66924dd0426de57504d79f3fc3164bd56c3.webp?v=1765438427"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43884005982307,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XU09","requires_shipping":true,"taxable":true,"featured_image":{"id":34932650082403,"product_id":7937816264803,"position":3,"created_at":"2025-12-11T15:33:42+08:00","updated_at":"2025-12-11T15:33:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424","variant_ids":[43884005982307]},"available":true,"name":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 超大型巨人 - Ash Grey","public_title":"Ash Grey","options":["Ash Grey"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01298O8-XU09","featured_media":{"alt":null,"id":26495021875299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bdc58d52a6ac03a1ac413dfecb1c6125d2e7887c.webp?v=1765438424"}},"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: "停產"
}