$product = {"id":7892392083555,"title":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱","handle":"iphone-15-pro-max-solidx-to55","description":null,"published_at":"2025-10-03T10:10:18+08:00","created_at":"2025-10-01T15:45:37+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-le-petit-prince","device-iPhone 15 Pro Max","merge","reseller-le-petit-prince"],"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":43755535138915,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104445027,"product_id":7892392083555,"position":9,"created_at":"2025-10-01T15:45:49+08:00","updated_at":"2025-10-01T15:45:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750","variant_ids":[43755535138915]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869517923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535171683,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542102347875,"product_id":7892392083555,"position":2,"created_at":"2025-10-01T15:45:40+08:00","updated_at":"2025-10-01T15:45:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742","variant_ids":[43755535171683]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111867420771,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535269987,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542102642787,"product_id":7892392083555,"position":3,"created_at":"2025-10-01T15:45:41+08:00","updated_at":"2025-10-01T15:45:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742","variant_ids":[43755535269987]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111867715683,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535302755,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104739939,"product_id":7892392083555,"position":10,"created_at":"2025-10-01T15:45:49+08:00","updated_at":"2025-10-01T15:45:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751","variant_ids":[43755535302755]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869812835,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535368291,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104019043,"product_id":7892392083555,"position":7,"created_at":"2025-10-01T15:45:47+08:00","updated_at":"2025-10-01T15:45:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749","variant_ids":[43755535368291]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869091939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02ebfb7f094a8b55f3dd47a31d3eb90c1b952ddd.webp?v=1759304741","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bae8795bacfefdfbbde4e946bcc971fe014075ef.webp?v=1759304743","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c8f2e2b8892e7d74e4e1e69a2bd5edaaac9008e.webp?v=1759304744","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f91e333f76de8686806c2dc7520797afea75ce0e.webp?v=1759304745","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5abda5f6f2b8c05e5006794b28d8d8d49d51da2a.webp?v=1759304749","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02ebfb7f094a8b55f3dd47a31d3eb90c1b952ddd.webp?v=1759304741","options":["color"],"media":[{"alt":null,"id":26111867125859,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02ebfb7f094a8b55f3dd47a31d3eb90c1b952ddd.webp?v=1759304741"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02ebfb7f094a8b55f3dd47a31d3eb90c1b952ddd.webp?v=1759304741","width":2000},{"alt":null,"id":26111867420771,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742","width":2000},{"alt":null,"id":26111867715683,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742","width":2000},{"alt":null,"id":26111868043363,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bae8795bacfefdfbbde4e946bcc971fe014075ef.webp?v=1759304743"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bae8795bacfefdfbbde4e946bcc971fe014075ef.webp?v=1759304743","width":2000},{"alt":null,"id":26111868338275,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c8f2e2b8892e7d74e4e1e69a2bd5edaaac9008e.webp?v=1759304744"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c8f2e2b8892e7d74e4e1e69a2bd5edaaac9008e.webp?v=1759304744","width":2000},{"alt":null,"id":26111868633187,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f91e333f76de8686806c2dc7520797afea75ce0e.webp?v=1759304745"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f91e333f76de8686806c2dc7520797afea75ce0e.webp?v=1759304745","width":2000},{"alt":null,"id":26111869091939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749","width":2000},{"alt":null,"id":26111869288547,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5abda5f6f2b8c05e5006794b28d8d8d49d51da2a.webp?v=1759304749"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5abda5f6f2b8c05e5006794b28d8d8d49d51da2a.webp?v=1759304749","width":2000},{"alt":null,"id":26111869517923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750","width":2000},{"alt":null,"id":26111869812835,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43755535138915,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104445027,"product_id":7892392083555,"position":9,"created_at":"2025-10-01T15:45:49+08:00","updated_at":"2025-10-01T15:45:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750","variant_ids":[43755535138915]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869517923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535171683,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542102347875,"product_id":7892392083555,"position":2,"created_at":"2025-10-01T15:45:40+08:00","updated_at":"2025-10-01T15:45:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742","variant_ids":[43755535171683]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111867420771,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3259d9947f6dce774f675846ddf7081c25bea76.webp?v=1759304742"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535269987,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542102642787,"product_id":7892392083555,"position":3,"created_at":"2025-10-01T15:45:41+08:00","updated_at":"2025-10-01T15:45:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742","variant_ids":[43755535269987]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111867715683,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff90cbe68f3ec926fec29a5c33eccde6feb8af57.webp?v=1759304742"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535302755,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104739939,"product_id":7892392083555,"position":10,"created_at":"2025-10-01T15:45:49+08:00","updated_at":"2025-10-01T15:45:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751","variant_ids":[43755535302755]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869812835,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eaed8dfb5d56a5e93640fbf6b0e532d163ccf316.webp?v=1759304751"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755535368291,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104019043,"product_id":7892392083555,"position":7,"created_at":"2025-10-01T15:45:47+08:00","updated_at":"2025-10-01T15:45:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749","variant_ids":[43755535368291]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869091939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4b074c99cc7e3086c0c3657988ba3228b65e2b5.webp?v=1759304749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43755535138915,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542104445027,"product_id":7892392083555,"position":9,"created_at":"2025-10-01T15:45:49+08:00","updated_at":"2025-10-01T15:45:50+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750","variant_ids":[43755535138915]},"available":true,"name":"iPhone 15 Pro Max SolidX 小王子 小王子與狐狸 - 擁抱 - 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-TO55","featured_media":{"alt":null,"id":26111869517923,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7e2cc0f63c7cd67eaa895ad0877ee55c9a1e822b.webp?v=1759304750"}},"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: "停產"
}