Kava Kava
Categories
Categories
Filter
Sort by
Sort by
1 product
-
Regular price $40.30 CADSale price $40.30 CAD Regular priceUnit price per
`;
// Replace the existing button with our new quick-add structure
const tempDiv = document.createElement('div');
tempDiv.innerHTML = quickAddHtml;
quickActionElement.innerHTML = '';
quickActionElement.classList.add('ls-add-to-cart-wrap');
quickActionElement.appendChild(tempDiv.firstElementChild);
// Add click handler to the newly created button to log activity
const button = quickActionElement.querySelector('.ls-quickview-button');
if (button) {
button.addEventListener('click', function() {
logQuickViewActivity(productId, boxType, hostPage);
});
}
}
function processPriceDisplay(productLinkElement, product) {
const priceElement = productLinkElement.querySelector(".ls-price");
if (!priceElement) return;
// Only proceed if the product price varies
if (!product.price_varies) return;
// Calculate min/max prices
let minPrice = product.price_min;
let maxPrice = product.price_max;
// Check all variants for min/max prices
for (let j = 0; j < product.variants.length; j++) {
const price = product.variants[j].price;
if (price < minPrice) minPrice = price;
if (price > maxPrice) maxPrice = price;
}
// Format prices
minPrice = "$" + (parseFloat(minPrice) / 100).toFixed(2);
maxPrice = "$" + (parseFloat(maxPrice) / 100).toFixed(2);
// Only add max price if it's not already shown
if (priceElement.innerHTML !== maxPrice) {
// Add max price element
const maximumPrice = document.createElement('span');
maximumPrice.className = 'ls-max-price';
maximumPrice.innerHTML = maxPrice;
priceElement.parentElement.appendChild(maximumPrice);
// Add class to min price
priceElement.classList.add("ls-min-price");
}
}
function applyTagBadges(productElement, product) {
// Find the sale sign wrapper
const saleSignWrapper = productElement.querySelector('.ls-sale-sign-wrap');
if (!saleSignWrapper) return;
// Clear existing content but keep the wrapper element
saleSignWrapper.innerHTML = '';
// Make sure the wrapper is visible
saleSignWrapper.style.display = 'block';
const badges = [];
// Standard sale badge
if (product.compare_at_price > product.price && product.available) {
badges.push('Sale');
}
// Sold out badge
if (!product.available) {
badges.push('Sold out');
}
// Process tags
if (product.tags && Array.isArray(product.tags)) {
product.tags.forEach(originalTag => {
const tag = originalTag.toLowerCase();
if (tag === 'price-drop') {
badges.push('Price drop');
} else if (tag === 'clearance') {
badges.push('Clearance');
} else if (tag === 'short-dated') {
badges.push('Short dated');
} else if (tag === 'vitamarts-pick') {
badges.push('Vitamart\'s pick');
} else if (tag === 'special-order') {
badges.push('Special order');
} else if (tag === 'vitamart-exclusive') {
badges.push('Vitamart exclusive');
} else if (tag === 'coming-soon') {
badges.push('Coming soon');
} else if (tag === 'best-value') {
badges.push('Best value');
} else if (tag === 'limited-edition') {
badges.push('Limited edition');
} else if (tag === 'staff-favorite') {
badges.push('Staff favorite');
} else if (tag === 'save-10') {
badges.push('Save 10%');
} else if (tag === 'save-10-dollars') {
badges.push('Save $10');
} else if (tag === 'save-20') {
badges.push('Save 20%');
} else if (tag === 'low-price') {
badges.push('Low price');
} else if (tag === 'discontinued') {
badges.push('Discontinued');
} else if (tag === 'new') {
badges.push('New');
} else if (tag === 'promo') {
badges.push('3 for$15');
} else if (tag === 'back-in-stock') {
badges.push('Back in stock');
} else if (tag === 'bogo') {
badges.push('1+1bogo');
} else if (tag === 'view-price-in-cart') {
badges.push('View price in cart');
} else if (tag === 'free-item') {
badges.push('Free item');
} else if (tag === 'characteristic:made in canada') {
badges.push('');
}
});
}
// Add badges content to the wrapper, even if empty
saleSignWrapper.innerHTML = badges.join('\
');
// Add a class to the wrapper to designate it as using badges format
saleSignWrapper.classList.add('ls-badges-container');
// Hide if no badges
if (badges.length === 0) {
saleSignWrapper.style.display = 'none';
}
}
1 product