$product = {"id":7829077459043,"title":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋","handle":"iphone-15-pro-max-solidx-bumper-back-crossover-design-jz57","description":null,"published_at":"2025-07-01T16:33:20+08:00","created_at":"2025-06-30T16:11:11+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-brothers","device-iPhone 15 Pro Max","merge","reseller-brothers"],"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":43502859747427,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099785007203,"product_id":7829077459043,"position":9,"created_at":"2025-06-30T16:11:19+08:00","updated_at":"2025-06-30T16:11:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081","variant_ids":[43502859747427]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756317515875,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863188067,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099783041123,"product_id":7829077459043,"position":6,"created_at":"2025-06-30T16:11:17+08:00","updated_at":"2025-06-30T16:11:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079","variant_ids":[43502863188067]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756316434531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863351907,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099785433187,"product_id":7829077459043,"position":10,"created_at":"2025-06-30T16:11:19+08:00","updated_at":"2025-06-30T16:11:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081","variant_ids":[43502863351907]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756317843555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863384675,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099780419683,"product_id":7829077459043,"position":2,"created_at":"2025-06-30T16:11:15+08:00","updated_at":"2025-06-30T16:11:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077","variant_ids":[43502863384675]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756314992739,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863417443,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099782287459,"product_id":7829077459043,"position":5,"created_at":"2025-06-30T16:11:16+08:00","updated_at":"2025-06-30T16:11:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078","variant_ids":[43502863417443]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756315975779,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5b7d43eb30db48acf389abc32955d15c97e3ec34.webp?v=1751271076","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f791ea2f93a0327086977d746a62d32c54a9741a.webp?v=1751271077","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/914f36acca2517122599e6b8da4e99bdeccf22b4.webp?v=1751271078","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/032681aa68a1543a8a56a12d48dd3c0a0876f07e.webp?v=1751271079","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db4a1e20a5ab212e7fad9721b92dcb889d4f24df.webp?v=1751271080","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5b7d43eb30db48acf389abc32955d15c97e3ec34.webp?v=1751271076","options":["color"],"media":[{"alt":null,"id":25756314828899,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5b7d43eb30db48acf389abc32955d15c97e3ec34.webp?v=1751271076"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5b7d43eb30db48acf389abc32955d15c97e3ec34.webp?v=1751271076","width":2000},{"alt":null,"id":25756314992739,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077","width":2000},{"alt":null,"id":25756315189347,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f791ea2f93a0327086977d746a62d32c54a9741a.webp?v=1751271077"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f791ea2f93a0327086977d746a62d32c54a9741a.webp?v=1751271077","width":2000},{"alt":null,"id":25756315418723,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/914f36acca2517122599e6b8da4e99bdeccf22b4.webp?v=1751271078"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/914f36acca2517122599e6b8da4e99bdeccf22b4.webp?v=1751271078","width":2000},{"alt":null,"id":25756315975779,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078","width":2000},{"alt":null,"id":25756316434531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079","width":2000},{"alt":null,"id":25756316893283,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/032681aa68a1543a8a56a12d48dd3c0a0876f07e.webp?v=1751271079"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/032681aa68a1543a8a56a12d48dd3c0a0876f07e.webp?v=1751271079","width":2000},{"alt":null,"id":25756317188195,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db4a1e20a5ab212e7fad9721b92dcb889d4f24df.webp?v=1751271080"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db4a1e20a5ab212e7fad9721b92dcb889d4f24df.webp?v=1751271080","width":2000},{"alt":null,"id":25756317515875,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081","width":2000},{"alt":null,"id":25756317843555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43502859747427,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099785007203,"product_id":7829077459043,"position":9,"created_at":"2025-06-30T16:11:19+08:00","updated_at":"2025-06-30T16:11:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081","variant_ids":[43502859747427]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756317515875,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863188067,"title":"Glacier Blue","option1":"Glacier Blue","option2":null,"option3":null,"sku":"NST01298Z7-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099783041123,"product_id":7829077459043,"position":6,"created_at":"2025-06-30T16:11:17+08:00","updated_at":"2025-06-30T16:11:19+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079","variant_ids":[43502863188067]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756316434531,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db230d5557ba5ed17d808c7831d3658a955f43f4.webp?v=1751271079"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863351907,"title":"Ash Grey","option1":"Ash Grey","option2":null,"option3":null,"sku":"NST01298O8-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099785433187,"product_id":7829077459043,"position":10,"created_at":"2025-06-30T16:11:19+08:00","updated_at":"2025-06-30T16:11:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081","variant_ids":[43502863351907]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756317843555,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75ce36164d1ccac087dd054bc2f894c20c09824e.webp?v=1751271081"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863384675,"title":"Blush Pink","option1":"Blush Pink","option2":null,"option3":null,"sku":"NST0129857-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099780419683,"product_id":7829077459043,"position":2,"created_at":"2025-06-30T16:11:15+08:00","updated_at":"2025-06-30T16:11:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077","variant_ids":[43502863384675]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756314992739,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80f2e6d696c75cc4933852d6e73dbc9bb458d5c2.webp?v=1751271077"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43502863417443,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129852-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099782287459,"product_id":7829077459043,"position":5,"created_at":"2025-06-30T16:11:16+08:00","updated_at":"2025-06-30T16:11:18+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078","variant_ids":[43502863417443]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756315975779,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ba9f26cd9adc2be9f86af3984d7bd80ba85184d0.webp?v=1751271078"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43502859747427,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129853-JZ57","requires_shipping":true,"taxable":true,"featured_image":{"id":34099785007203,"product_id":7829077459043,"position":9,"created_at":"2025-06-30T16:11:19+08:00","updated_at":"2025-06-30T16:11:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081","variant_ids":[43502859747427]},"available":true,"name":"iPhone 15 Pro Max SolidX 中信兄弟 BROTHERS 洲際高校夢幻紫-林吳晉瑋 - 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-JZ57","featured_media":{"alt":null,"id":25756317515875,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/88b14813378c63701228d18110ffaf983c820f1c.webp?v=1751271081"}},"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: "停產"
}