// Basic initialization and debug logging
Ecwid.OnPageLoaded.add(function(page) {
console.log('Ecwid page loaded:', page.type);
// Only proceed on product or cart pages
if (page.type === 'PRODUCT' || page.type === 'CART') {
console.log('On product or cart page - attempting to initialize Sezzle');
// Add a visible marker where we expect prices to be
setTimeout(function() {
// Try to find price elements
const productPriceElements = document.querySelectorAll('.details-product-price__price');
const cartPriceElements = document.querySelectorAll('.ec-cart__price');
console.log('Found product price elements:', productPriceElements.length);
console.log('Found cart price elements:', cartPriceElements.length);
// Add visible markers next to price elements
productPriceElements.forEach(el => {
const marker = document.createElement('div');
marker.style.color = 'red';
marker.textContent = '→ Sezzle Widget Should Appear Here ←';
el.parentNode.insertBefore(marker, el.nextSibling);
});
cartPriceElements.forEach(el => {
const marker = document.createElement('div');
marker.style.color = 'red';
marker.textContent = '→ Sezzle Widget Should Appear Here ←';
el.parentNode.insertBefore(marker, el.nextSibling);
});
// Log the complete HTML structure around price elements
console.log('Product price element context:',
productPriceElements.length > 0 ? productPriceElements[0].parentNode.outerHTML : 'Not found');
console.log('Cart price element context:',
cartPriceElements.length > 0 ? cartPriceElements[0].parentNode.outerHTML : 'Not found');
}, 1000); // Wait 1 second for dynamic content to load
}
});