Guess

Summa: 0 €999 €

Nav nekas atrasts!

Jaunumi

Izstrādāja

Developed by

Izstrādāja

Developed by

function updateAllHeaderCartTotals(finalPrice) { document.querySelectorAll('.wpr-mini-cart-toggle-btn .wpr-mini-cart-btn-price .woocommerce-Price-amount.amount bdi') .forEach(function(el) { el.innerHTML = finalPrice; }); } // Mēģina vairākas reizes pēc lapas ielādes (ja header parādās ar aizturi) function tryUpdateHeaderUntilReady(finalPrice, attempts = 10) { if (attempts < 1) return; var headerEls = document.querySelectorAll('.wpr-mini-cart-toggle-btn .wpr-mini-cart-btn-price .woocommerce-Price-amount.amount bdi'); if (headerEls.length) { updateAllHeaderCartTotals(finalPrice); } else { setTimeout(function() { tryUpdateHeaderUntilReady(finalPrice, attempts - 1); }, 250); } } function fetchAndUpdateHeaderCartTotal() { fetch('/cart/') .then(response => response.text()) .then(html => { var tempDiv = document.createElement('div'); tempDiv.innerHTML = html; var totalEl = tempDiv.querySelector('.order-total .amount bdi') || tempDiv.querySelector('.order-total .amount'); if (totalEl) { tryUpdateHeaderUntilReady(totalEl.innerHTML.trim(), 10); } }); } // Uzreiz pēc lapas ielādes – vairākas reizes pēc kārtas (aizturei) document.addEventListener('DOMContentLoaded', fetchAndUpdateHeaderCartTotal); // Pēc WooCommerce AJAX eventiem – arī atjauno ['updated_wc_div','updated_cart_totals','updated_checkout','wpr_minicart_refreshed','wpr_minicart_updated','wc_fragments_refreshed'].forEach(function(event) { document.body.addEventListener(event, fetchAndUpdateHeaderCartTotal); });
×