$product = {"id":7863457218659,"title":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light","handle":"iphone-17-pro-jellytint-magsafe-with-capture-button-pm03","description":null,"published_at":"2025-09-10T18:22:05+08:00","created_at":"2025-08-22T19:05:54+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 17 Pro","merge","reseller-nba"],"price":148000,"price_min":148000,"price_max":148000,"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":43609055887459,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013520G-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152516804707,"product_id":7863457218659,"position":12,"created_at":"2026-07-02T12:24:32+08:00","updated_at":"2026-07-02T12:24:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274","variant_ids":[43609055887459]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013520G-PM03","featured_media":{"alt":null,"id":27657390293091,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43609056936035,"title":"Nocturne Blue","option1":"Nocturne Blue","option2":null,"option3":null,"sku":"MJB013524M-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152516477027,"product_id":7863457218659,"position":11,"created_at":"2026-07-02T12:24:32+08:00","updated_at":"2026-07-02T12:24:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274","variant_ids":[43609056936035]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Nocturne Blue","public_title":"Nocturne Blue","options":["Nocturne Blue"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013524M-PM03","featured_media":{"alt":null,"id":27657389965411,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43609056968803,"title":"Gleam Rosé","option1":"Gleam Rosé","option2":null,"option3":null,"sku":"MJB013524L-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152517197923,"product_id":7863457218659,"position":13,"created_at":"2026-07-02T12:24:33+08:00","updated_at":"2026-07-02T12:24:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275","variant_ids":[43609056968803]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Gleam Rosé","public_title":"Gleam Rosé","options":["Gleam Rosé"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013524L-PM03","featured_media":{"alt":null,"id":27657390686307,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-352-PM03_ec0faf9e-a2a4-451a-b86f-982f1c1068aa.png?v=1755860757","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928.webp?v=1782213307","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd.webp?v=1782213308","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8.webp?v=1782213308","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c825fb55-2737-4b01-ab21-6db700b62453.webp?v=1782958606","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_0dac8665-3da7-4259-a35d-d43626e0df77.webp?v=1782958607","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_aee3d80e-c4e7-4f65-abcc-246b9c4f04ef.webp?v=1782958608","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c82b4966-01b1-46c4-ab47-60ccf4e9f3fd.webp?v=1782961958","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_6d28a959-938b-4c36-ae0e-3862e7f0b372.webp?v=1782961963","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_ee07df85-63fd-45f4-9b93-9cb23499bf51.webp?v=1782961968","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-352-PM03_ec0faf9e-a2a4-451a-b86f-982f1c1068aa.png?v=1755860757","options":["color"],"media":[{"alt":null,"id":25941546205283,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-352-PM03_ec0faf9e-a2a4-451a-b86f-982f1c1068aa.png?v=1755860757"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/Clear-F5-352-PM03_ec0faf9e-a2a4-451a-b86f-982f1c1068aa.png?v=1755860757","width":2000},{"alt":null,"id":27578447986787,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928.webp?v=1782213307"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928.webp?v=1782213307","width":2000},{"alt":null,"id":27578448642147,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd.webp?v=1782213308"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd.webp?v=1782213308","width":2000},{"alt":null,"id":27578448937059,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8.webp?v=1782213308"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8.webp?v=1782213308","width":2000},{"alt":null,"id":27656226209891,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c825fb55-2737-4b01-ab21-6db700b62453.webp?v=1782958606"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c825fb55-2737-4b01-ab21-6db700b62453.webp?v=1782958606","width":2000},{"alt":null,"id":27656226996323,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_0dac8665-3da7-4259-a35d-d43626e0df77.webp?v=1782958607"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_0dac8665-3da7-4259-a35d-d43626e0df77.webp?v=1782958607","width":2000},{"alt":null,"id":27656227651683,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_aee3d80e-c4e7-4f65-abcc-246b9c4f04ef.webp?v=1782958608"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_aee3d80e-c4e7-4f65-abcc-246b9c4f04ef.webp?v=1782958608","width":2000},{"alt":null,"id":27656891859043,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c82b4966-01b1-46c4-ab47-60ccf4e9f3fd.webp?v=1782961958"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_c82b4966-01b1-46c4-ab47-60ccf4e9f3fd.webp?v=1782961958","width":2000},{"alt":null,"id":27656893071459,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_6d28a959-938b-4c36-ae0e-3862e7f0b372.webp?v=1782961963"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_6d28a959-938b-4c36-ae0e-3862e7f0b372.webp?v=1782961963","width":2000},{"alt":null,"id":27656894480483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_ee07df85-63fd-45f4-9b93-9cb23499bf51.webp?v=1782961968"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_ee07df85-63fd-45f4-9b93-9cb23499bf51.webp?v=1782961968","width":2000},{"alt":null,"id":27657389965411,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274","width":2000},{"alt":null,"id":27657390293091,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274","width":2000},{"alt":null,"id":27657390686307,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43609055887459,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013520G-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152516804707,"product_id":7863457218659,"position":12,"created_at":"2026-07-02T12:24:32+08:00","updated_at":"2026-07-02T12:24:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274","variant_ids":[43609055887459]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013520G-PM03","featured_media":{"alt":null,"id":27657390293091,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43609056936035,"title":"Nocturne Blue","option1":"Nocturne Blue","option2":null,"option3":null,"sku":"MJB013524M-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152516477027,"product_id":7863457218659,"position":11,"created_at":"2026-07-02T12:24:32+08:00","updated_at":"2026-07-02T12:24:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274","variant_ids":[43609056936035]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Nocturne Blue","public_title":"Nocturne Blue","options":["Nocturne Blue"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013524M-PM03","featured_media":{"alt":null,"id":27657389965411,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d7768a51eac2a0408c3b0597579096d89ea73bd_ea7287cf-c938-490b-ad8c-16a969adf8cb.webp?v=1782966274"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43609056968803,"title":"Gleam Rosé","option1":"Gleam Rosé","option2":null,"option3":null,"sku":"MJB013524L-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152517197923,"product_id":7863457218659,"position":13,"created_at":"2026-07-02T12:24:33+08:00","updated_at":"2026-07-02T12:24:35+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275","variant_ids":[43609056968803]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Gleam Rosé","public_title":"Gleam Rosé","options":["Gleam Rosé"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013524L-PM03","featured_media":{"alt":null,"id":27657390686307,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dfed74a9e08dd46c26c5364d5b76ad000d7b99f8_24da57bf-b9b4-455f-8e90-f83dd4cd19e4.webp?v=1782966275"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43609055887459,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"MJB013520G-PM03","requires_shipping":true,"taxable":true,"featured_image":{"id":36152516804707,"product_id":7863457218659,"position":12,"created_at":"2026-07-02T12:24:32+08:00","updated_at":"2026-07-02T12:24:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274","variant_ids":[43609055887459]},"available":true,"name":"iPhone 17 Pro Clear (MagSafe 兼容 \u0026 相機按鈕) NBA Logo-芝加哥公牛 Chicago Bulls - Light - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":148000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MJB013520G-PM03","featured_media":{"alt":null,"id":27657390293091,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/085bcebe57d75a3a230ab17c885621ca19e9d928_10dd1bc6-15b2-4e5d-8674-5580b4da8508.webp?v=1782966274"}},"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: "停產"
}