1. Создать блок ME606 для промокодов и задать ему класс uc-promolist
  2. Создать блок Т123 и прописать туда код
  3. Эти блоки должны быть добавлены в обычный и продуктовый footer
<!--КОД ДЛЯ ПРОМОКОДОВ НА ДОСТАВКУ-->
<script>
document.addEventListener("DOMContentLoaded", function() {
    (function () {
        
        const promoText = `Промокод доставки успешно активирован`;
        
        const promocodeList = [];
        let deliveryActive = false;

        const promocodeElement = document.querySelectorAll('.uc-promolist .t976__menu-link');
        if(promocodeElement.length){
            
            for(let i=0; i<promocodeElement.length; i++){
                promocodeList.push(promocodeElement[i].innerText);
            };
            
            setTimeout(function() {
                const promoWrapper = document.querySelector('.t706 .t-inputpromocode__wrapper');
                const promoInput = promoWrapper.querySelector('input');
                const promoBtn = promoWrapper.querySelector('.t-btn');
            
                const hiddenPromo = document.querySelector('.t706 input[name="delivery_promocode"]');
            
                promoWrapper.addEventListener('click', function(event) {

                    if(!event.target.closest('.t-input')){
                    
                        const promoVal = promoInput.value;
                        
                        if(promoVal!=''){
                            
                            let detectedPromo = '';
                            for(let i=0; i<promocodeList.length; i++){
                                if(promoVal==promocodeList[i]){
                                    detectedPromo = promoVal;
                                };
                            };
                            
                            if(detectedPromo==''){
                                promoBtn.click();
                            }else{
                                deliveryActive = true;
                                promoWrapper.innerHTML = `
                                    <div class="promo-text-final t-text">
                                        ${promoText}
                                        <span>${detectedPromo}</span>
                                    </div>
                                `;
                                
                                if(hiddenPromo!=null) hiddenPromo.value = detectedPromo;

                                
                                
                                checkDelivery();
                                
                                
                                setTimeout(function() {
                                    
                                    const deliveryInput = document.querySelectorAll('input.t-radio_delivery');
                                
                                    for(j=0; j<deliveryInput.length; j++){
                                            
                                        if(deliveryInput[j].checked){
                                            deliveryInput[j].dispatchEvent(new Event('change', { bubbles: true }));
                                        };
                                              
                                    };
                                    
                                    
                                }, 600);
                                
                                
                            };
                        };
                    
                    };
                    
                });
                
                
                
                let changeActive = true;
                
                function checkDelivery(){
                    
                    
                    if(deliveryActive){
                        setTimeout(function() {
                            
                            const currency = tcart.currency_txt;
                            const deliveryWrapper = document.querySelectorAll('#delivery-services-wrapper label');
                            
                            if(deliveryWrapper.length){
                                for(let i=0; i<deliveryWrapper.length; i++){
                                    
                                    
                                    deliveryWrapper[i].querySelector('.t-radio.t-radio_delivery').setAttribute('data-free-delivery-threshold', 1);
                                    
                                    
                                    
                                };
                            };
                            tcart.delivery.freedl = 1;
                            
                            document.querySelector('.t706').classList.add('promocode-active');
                            
                            //if(changeActive){
                                
                                
                                const deliveryInput = document.querySelectorAll('input.t-radio_delivery');
                                
                                for(j=0; j<deliveryInput.length; j++){
                                        
                                    if(deliveryInput[j].checked){
                                            //deliveryInput[j].dispatchEvent(new Event('change', { bubbles: true }));
                                    };
                                          
                                };
                                
                                //document.querySelector('input.t-radio_delivery').dispatchEvent(new Event('change', { bubbles: true }));
                                
                                
                                
                                //changeActive = false;
                            //};
                            
                            //setTimeout(function() {
                            //    changeActive = true;
                            //}, 600);
                            
                            
                        }, 300);
                    };
                };
                
                
                const observer = new MutationObserver(mutationRecords => {
                    if(changeActive) checkDelivery();
                });
                
                const elem  = document.querySelector('.t706__cartwin-prodamount');
                observer.observe(elem, {
                  childList: true, 
                  subtree: true, 
                  characterDataOldValue: true
                });

            }, 1000);
              
        };
        
    })();    
});    
</script>

<style>
.t706 .t-inputpromocode__btn.t-btn {
    pointer-events: none;
}

.t706 .t-inputpromocode__wrapper {
    cursor: pointer;
}    

.promo-text-final.t-text {
    font-size: 18px;
    font-weight: 600;
}

.promo-text-final.t-text span {
    font-size: 24px;
    text-decoration: underline;
}
.uc-promolist{
    display: none;
}

.promocode-active span.delivery-minimum-price {
    font-size: 0 !important;
}

.promocode-active span.delivery-minimum-price:after {
    content: ", 0 р.";
    font-size: 14px;
}

</style>
Made on
Tilda