$product = {"id":7827213615203,"title":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome","handle":"iphone-12-pro-max-solidsuit-magsafe-bumper-back-crossover-design-tdf02","description":null,"published_at":"2025-07-14T11:34:25+08:00","created_at":"2025-06-26T15:12:34+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-tour-de-france","device-iPhone 12 Pro Max","merge","reseller-tour-de-france"],"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":43497172959331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081645723747,"product_id":7827213615203,"position":2,"created_at":"2025-06-26T15:12:38+08:00","updated_at":"2025-06-26T15:12:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960","variant_ids":[43497172959331]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118752-TDF02","featured_media":{"alt":null,"id":25742608171107,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497172992099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081647231075,"product_id":7827213615203,"position":4,"created_at":"2025-06-26T15:12:39+08:00","updated_at":"2025-06-26T15:12:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961","variant_ids":[43497172992099]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870B-TDF02","featured_media":{"alt":null,"id":25742608498787,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173123171,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081649229923,"product_id":7827213615203,"position":9,"created_at":"2025-06-26T15:12:42+08:00","updated_at":"2025-06-26T15:12:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964","variant_ids":[43497173123171]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870E-TDF02","featured_media":{"alt":null,"id":25742610727011,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173188707,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081645396067,"product_id":7827213615203,"position":1,"created_at":"2025-06-26T15:12:38+08:00","updated_at":"2025-06-26T15:12:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960","variant_ids":[43497173188707]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Classic Blue","public_title":"Classic Blue","options":["Classic Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870C-TDF02","featured_media":{"alt":null,"id":25742607777891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173221475,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081648705635,"product_id":7827213615203,"position":7,"created_at":"2025-06-26T15:12:41+08:00","updated_at":"2025-06-26T15:12:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963","variant_ids":[43497173221475]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01187O9-TDF02","featured_media":{"alt":null,"id":25742608957539,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb0a39987b8ff9e946bc03cb7c1e064cfe87add5.webp?v=1750921961","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80600f520f81bccd3a40895c99c34b49aeac1c5e.webp?v=1750921962","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a092e8b4134034120dd988897a15b4c0e9bcc4dc.webp?v=1750921962","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5858fe1f6fb402fe9b49a0e80c5ae653a76a9d5c.webp?v=1750921963","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e135262560fe38d7215c04c0a9ad4f0546d1983.webp?v=1750921964"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960","options":["color"],"media":[{"alt":null,"id":25742607777891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960","width":2000},{"alt":null,"id":25742608171107,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960","width":2000},{"alt":null,"id":25742608334947,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb0a39987b8ff9e946bc03cb7c1e064cfe87add5.webp?v=1750921961"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb0a39987b8ff9e946bc03cb7c1e064cfe87add5.webp?v=1750921961","width":2000},{"alt":null,"id":25742608498787,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961","width":2000},{"alt":null,"id":25742608695395,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80600f520f81bccd3a40895c99c34b49aeac1c5e.webp?v=1750921962"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/80600f520f81bccd3a40895c99c34b49aeac1c5e.webp?v=1750921962","width":2000},{"alt":null,"id":25742608760931,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a092e8b4134034120dd988897a15b4c0e9bcc4dc.webp?v=1750921962"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a092e8b4134034120dd988897a15b4c0e9bcc4dc.webp?v=1750921962","width":2000},{"alt":null,"id":25742608957539,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963","width":2000},{"alt":null,"id":25742609121379,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5858fe1f6fb402fe9b49a0e80c5ae653a76a9d5c.webp?v=1750921963"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5858fe1f6fb402fe9b49a0e80c5ae653a76a9d5c.webp?v=1750921963","width":2000},{"alt":null,"id":25742610727011,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964","width":2000},{"alt":null,"id":25742610890851,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e135262560fe38d7215c04c0a9ad4f0546d1983.webp?v=1750921964"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4e135262560fe38d7215c04c0a9ad4f0546d1983.webp?v=1750921964","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43497172959331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081645723747,"product_id":7827213615203,"position":2,"created_at":"2025-06-26T15:12:38+08:00","updated_at":"2025-06-26T15:12:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960","variant_ids":[43497172959331]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118752-TDF02","featured_media":{"alt":null,"id":25742608171107,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497172992099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"MST011870B-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081647231075,"product_id":7827213615203,"position":4,"created_at":"2025-06-26T15:12:39+08:00","updated_at":"2025-06-26T15:12:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961","variant_ids":[43497172992099]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870B-TDF02","featured_media":{"alt":null,"id":25742608498787,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/73897764648fd9aa7b0f44e8b78d8710f9243738.webp?v=1750921961"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173123171,"title":"Parakeet Green","option1":"Parakeet Green","option2":null,"option3":null,"sku":"MST011870E-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081649229923,"product_id":7827213615203,"position":9,"created_at":"2025-06-26T15:12:42+08:00","updated_at":"2025-06-26T15:12:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964","variant_ids":[43497173123171]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Parakeet Green","public_title":"Parakeet Green","options":["Parakeet Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870E-TDF02","featured_media":{"alt":null,"id":25742610727011,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edc6a1fc5a7af08fb3b1f17043f55e2debf84e6.webp?v=1750921964"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173188707,"title":"Classic Blue","option1":"Classic Blue","option2":null,"option3":null,"sku":"MST011870C-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081645396067,"product_id":7827213615203,"position":1,"created_at":"2025-06-26T15:12:38+08:00","updated_at":"2025-06-26T15:12:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960","variant_ids":[43497173188707]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Classic Blue","public_title":"Classic Blue","options":["Classic Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST011870C-TDF02","featured_media":{"alt":null,"id":25742607777891,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd00bf3bb4e3791cec1603760dcf2af7ce077f5c.webp?v=1750921960"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43497173221475,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"MST01187O9-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081648705635,"product_id":7827213615203,"position":7,"created_at":"2025-06-26T15:12:41+08:00","updated_at":"2025-06-26T15:12:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963","variant_ids":[43497173221475]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01187O9-TDF02","featured_media":{"alt":null,"id":25742608957539,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f634adb91724e956c7f922a96d931750a274592.webp?v=1750921963"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43497172959331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0118752-TDF02","requires_shipping":true,"taxable":true,"featured_image":{"id":34081645723747,"product_id":7827213615203,"position":2,"created_at":"2025-06-26T15:12:38+08:00","updated_at":"2025-06-26T15:12:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960","variant_ids":[43497172959331]},"available":true,"name":"iPhone 12 Pro Max SolidSuit (MagSafe 兼容) Tour de France Monochrome - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0118752-TDF02","featured_media":{"alt":null,"id":25742608171107,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14911c6dce28f0ec46aef0c5b3f9e29306f5055e.webp?v=1750921960"}},"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: "停產"
}