100% VIRGIN HAIR💜 HD LACE💜 Curly Glueless Wigs
₦105,000
₦230,000
SAVE 54%
${(function() {
var variantData = data.variant;
var productData = data.product;
var hasDiscount = false;
var discountPercentage = 0;
var currentPrice = 0;
var comparePrice = 0;
// 关键修复:更全面地检查所有可能的原价字段
if (variantData) {
currentPrice = variantData.price;
// 按优先级尝试获取原价
comparePrice = variantData.compare_at_price
|| variantData.compareAtPrice
|| (productData && productData.compare_at_price_max)
|| (productData && productData.compareAtPriceMax)
|| 0;
// 确保 comparePrice 是数字
comparePrice = Number(comparePrice) || 0;
currentPrice = Number(currentPrice) || 0;
if (comparePrice > currentPrice && currentPrice > 0) {
hasDiscount = true;
discountPercentage = Math.round(((comparePrice - currentPrice) / comparePrice) * 100);
}
} else if (productData) {
// 产品级别的价格
currentPrice = productData.price || productData.price_min || productData.priceMin || 0;
comparePrice = productData.compare_at_price_max
|| productData.compareAtPriceMax
|| productData.compare_at_price
|| productData.compareAtPrice
|| 0;
// 确保是数字
comparePrice = Number(comparePrice) || 0;
currentPrice = Number(currentPrice) || 0;
if (comparePrice > currentPrice && currentPrice > 0) {
hasDiscount = true;
discountPercentage = Math.round(((comparePrice - currentPrice) / comparePrice) * 100);
}
}
// 调试信息(生产环境可删除)
console.log('Price Debug:', {
variantData: variantData,
productData: productData,
currentPrice: currentPrice,
comparePrice: comparePrice,
hasDiscount: hasDiscount,
discountPercentage: discountPercentage
});
var priceHtml = '';
priceHtml += '
';
priceHtml += '
';
priceHtml += '
';
if (variantData || productData) {
priceHtml += '';
if (hasDiscount && comparePrice > 0) {
priceHtml += '';
}
}
priceHtml += '
';
if (hasDiscount && discountPercentage > 0) {
priceHtml += '
SAVE ' + discountPercentage + '%
';
}
priceHtml += '
';
return priceHtml;
})()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
Product was out of stock.
Product is unavailable.