<!--КОД ДОСТАВКИ ДЛЯ КОРЗИНЫ-->

<script>

//Сумма для бесплатной доставки
const freeDeliverySumm = 5000;

//Цена доставки по кол-ву наборов
const deliveryPrice = {
    "1":400,
    "2":250,
    "3":150,
    "4":0,
};

//Разделы для исключения
const exceptParts = ['220642105752','526035545462','665511380762'];

t_onReady(function() {
    setTimeout(function() {
        t_onFuncLoad('tcart__init',function() {
            controlOfProductChange();     
        });
    },200);    
});


function controlOfProductChange(){
    const observer = new MutationObserver(mutationRecords => {
        changeDeliveryPrice();     
    });
    
    const elem  = document.querySelector('.t706__cartwin-products');
    observer.observe(elem, {
        childList: true, 
        subtree: true, 
        characterDataOldValue: true
    });
};


function changeDeliveryPrice(){
    let cartTotal = 1;
    const productList = tcart.products;
    let normalQuant = 0;
    let exceptQuant = 0;
    
    productList.forEach(product => {
        let normal = false;
        if (product.part_uids && product.part_uids.length > 0) {
            product.part_uids.forEach(partUid => {
                if (partUid && exceptParts.includes(partUid)) {
                    exceptQuant += product.quantity;
                }else{
                    normal = true;
                };
            });
        };
        if(normal) normalQuant += product.quantity;
    });
    
    
    if(normalQuant==0) normalQuant=1;
    
    cartTotal = normalQuant;
    
    const prodAmount = +tcart.prodamount;
    if(prodAmount>=freeDeliverySumm) cartTotal=4;
    
    const price = cartTotal >= 4 ? deliveryPrice["4"] : deliveryPrice[String(cartTotal)];

    const deliveryInput = document.querySelector('input.t-radio_delivery');
    if (deliveryInput) {
        deliveryInput.setAttribute('data-delivery-price', price);
        tcart__updateDelivery();
    };
};
    
</script>


<style>
.t706__cartwin-bottom {
    padding-top: 10px;
}

.t706__orderform {
    margin-top: -15px;
}


.t-input-group.t-input-group_pm {
    margin: 20px 0 10px 0 !important;
}

.t-input-group.t-input-group_tx {
    margin-bottom: 15px;
}

.t706__cartwin-totalamount-wrap {
    padding-top: 0px;
}   

.t706 .t-form__inputsbox.t-form__inputsbox_inrow {
    display: flex;
    flex-direction: column;
}

.t706__cartwin-totalamount-wrap {
    order: -1;
    padding: 0;
    margin-bottom: 15px;
}

.t706__orderform {
    margin-top: -30px;
}

.t706__cartwin-totalamount-info span:nth-child(1), 
.t706__cartwin-totalamount-info span:nth-child(2), 
.t706__cartwin-totalamount-info br:nth-child(3)
{
    display: none;
}


span.t706__cartwin-prodamount-label:after {
    content: "Стоимость товара:";
    font-size: 14px;
}

span.t706__cartwin-prodamount-label {
    font-size: 0;
}

.t706__cartwin-prodamount-wrap {
    font-weight: 400;
    font-size: 14px;
}

</style>
Надо настроить стоимость доставки по этим параметрам:

СТОИМОСТЬ ДОСТАВКИ:
1 набор - 400 руб.*
2 набора - 250 руб.*
3 набора - 150 руб.*
4 набора - БЕСПЛАТНО!*

Это прописана в корзине....

В подсчете стоимости доставки НЕ ДОЛЖНЫ УЧАСТВОВАТЬ 3 Раздела Каталога!
- Напитки и кофе
- Кофе "EFFEECO"
- Добавить к заказу

Html code will be here

Made on
Tilda