<script>
function updateTotalPrice() {
const totalPriceElem = document.querySelector('.t706__cartwin-totalamount .t706__cartwin-prodamount-price');
const productItems = document.querySelectorAll('.t706__product');
if (totalPriceElem && productItems.length > 0) {
let total = 0;
productItems.forEach(item => {
const totalAmountElem = item.querySelector('.t706__cartwin-prodamount-price');
if (totalAmountElem) {
const totalAmount = parseFloat(totalAmountElem.textContent.replace(/\s+/g, '').replace(',', '.'));
total += totalAmount;
}
});
// Увеличиваем итоговую сумму на 10%
const updatedPrice = total * 1.10; // Добавляем 10%
totalPriceElem.textContent = Math.round(updatedPrice); // Округляем результат до ближайшего целого
}
}
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList' || mutation.type === 'subtree') {
updateTotalPrice();
}
}
});
const cartElement = document.querySelector('.t706__cartwin-products');
if (cartElement) {
observer.observe(cartElement, { childList: true, subtree: true });
}
updateTotalPrice();
</script>