$product = {"id":7938082242659,"title":"iPhone 15 Pro Max SolidX 進擊的巨人 Attack on Titan 地鳴","handle":"iphone-15-pro-max-solidx-xw10","description":null,"published_at":"2025-12-12T09:59:00+08:00","created_at":"2025-12-11T16:59:39+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":43885034307683,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767110755,"product_id":7938082242659,"position":1,"created_at":"2025-12-11T16:59:44+08:00","updated_at":"2025-12-11T16:59:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","variant_ids":[43885034307683]},"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-XW10","featured_media":{"alt":null,"id":26496136347747,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034340451,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767667811,"product_id":7938082242659,"position":5,"created_at":"2025-12-11T16:59:46+08:00","updated_at":"2025-12-11T16:59:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587","variant_ids":[43885034340451]},"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-XW10","featured_media":{"alt":null,"id":26496136904803,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034471523,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933768093795,"product_id":7938082242659,"position":9,"created_at":"2025-12-11T16:59:48+08:00","updated_at":"2025-12-11T16:59:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589","variant_ids":[43885034471523]},"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-XW10","featured_media":{"alt":null,"id":26496137330787,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034504291,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933768224867,"product_id":7938082242659,"position":10,"created_at":"2025-12-11T16:59:48+08:00","updated_at":"2025-12-11T16:59:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590","variant_ids":[43885034504291]},"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-XW10","featured_media":{"alt":null,"id":26496137461859,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034537059,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767438435,"product_id":7938082242659,"position":3,"created_at":"2025-12-11T16:59:45+08:00","updated_at":"2025-12-11T16:59:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586","variant_ids":[43885034537059]},"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-XW10","featured_media":{"alt":null,"id":26496136675427,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5089e9bc3d0fbc1e50b41062bf5f0c83b53507fd.webp?v=1765443586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1852e0dd056f8368353755f1f4a7f2d9dc43fc5.webp?v=1765443587","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70c19640ef4a47f69e0e20f0432aed4d83347b7b.webp?v=1765443588","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06d18cdb3b1821528c7ea1f344a4a6f6a9b70fa6.webp?v=1765443588","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b229ea39a3997234418258887caddba2495938a.webp?v=1765443589","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","options":["color"],"media":[{"alt":null,"id":26496136347747,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","width":2000},{"alt":null,"id":26496136511587,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5089e9bc3d0fbc1e50b41062bf5f0c83b53507fd.webp?v=1765443586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5089e9bc3d0fbc1e50b41062bf5f0c83b53507fd.webp?v=1765443586","width":2000},{"alt":null,"id":26496136675427,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586","width":2000},{"alt":null,"id":26496136773731,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1852e0dd056f8368353755f1f4a7f2d9dc43fc5.webp?v=1765443587"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d1852e0dd056f8368353755f1f4a7f2d9dc43fc5.webp?v=1765443587","width":2000},{"alt":null,"id":26496136904803,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587","width":2000},{"alt":null,"id":26496137035875,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70c19640ef4a47f69e0e20f0432aed4d83347b7b.webp?v=1765443588"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70c19640ef4a47f69e0e20f0432aed4d83347b7b.webp?v=1765443588","width":2000},{"alt":null,"id":26496137101411,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06d18cdb3b1821528c7ea1f344a4a6f6a9b70fa6.webp?v=1765443588"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06d18cdb3b1821528c7ea1f344a4a6f6a9b70fa6.webp?v=1765443588","width":2000},{"alt":null,"id":26496137199715,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b229ea39a3997234418258887caddba2495938a.webp?v=1765443589"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b229ea39a3997234418258887caddba2495938a.webp?v=1765443589","width":2000},{"alt":null,"id":26496137330787,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589","width":2000},{"alt":null,"id":26496137461859,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43885034307683,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767110755,"product_id":7938082242659,"position":1,"created_at":"2025-12-11T16:59:44+08:00","updated_at":"2025-12-11T16:59:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","variant_ids":[43885034307683]},"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-XW10","featured_media":{"alt":null,"id":26496136347747,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034340451,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767667811,"product_id":7938082242659,"position":5,"created_at":"2025-12-11T16:59:46+08:00","updated_at":"2025-12-11T16:59:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587","variant_ids":[43885034340451]},"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-XW10","featured_media":{"alt":null,"id":26496136904803,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fe4b60d334b09f320c8fe7b9e7f224ecef1af72b.webp?v=1765443587"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034471523,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933768093795,"product_id":7938082242659,"position":9,"created_at":"2025-12-11T16:59:48+08:00","updated_at":"2025-12-11T16:59:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589","variant_ids":[43885034471523]},"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-XW10","featured_media":{"alt":null,"id":26496137330787,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/84365d756716dc48d328f4142f9c5a58b06ae01b.webp?v=1765443589"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034504291,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933768224867,"product_id":7938082242659,"position":10,"created_at":"2025-12-11T16:59:48+08:00","updated_at":"2025-12-11T16:59:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590","variant_ids":[43885034504291]},"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-XW10","featured_media":{"alt":null,"id":26496137461859,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/831cd3ec90150fc1dc58a27f65cfa5953b335845.webp?v=1765443590"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43885034537059,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767438435,"product_id":7938082242659,"position":3,"created_at":"2025-12-11T16:59:45+08:00","updated_at":"2025-12-11T16:59:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586","variant_ids":[43885034537059]},"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-XW10","featured_media":{"alt":null,"id":26496136675427,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a46e063b8ed78b510b4a6f5e3c678dbdf687332.webp?v=1765443586"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43885034307683,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-XW10","requires_shipping":true,"taxable":true,"featured_image":{"id":34933767110755,"product_id":7938082242659,"position":1,"created_at":"2025-12-11T16:59:44+08:00","updated_at":"2025-12-11T16:59:45+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585","variant_ids":[43885034307683]},"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-XW10","featured_media":{"alt":null,"id":26496136347747,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/08a576c1d3ae582c8260d1cc17b0dd551e3a2413.webp?v=1765443585"}},"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: "停產"
}