<script>
document.addEventListener("DOMContentLoaded", function() {
(function () {
const freesumm = 3000;
let st1 = true, st2 = true;
const deliverys = document.querySelectorAll('.t-input-group_dl .t-radio__control');
deliverys[0].classList.add('hide-delivery');
function changeDelivery(){
const summ = tcart.prodamount;
if ( summ >= freesumm && st1 ) {
deliverys[0].classList.remove('hide-delivery');
deliverys[1].classList.add('hide-delivery');
if (deliverys[1].querySelector('input').checked) {
setTimeout(function(){
deliverys[0].querySelector('input').click();
}, 100);
};
st1 = false;
st2 = true;
};
if(summ < freesumm && st2){
deliverys[0].classList.add('hide-delivery');
deliverys[1].classList.remove('hide-delivery');
if (deliverys[0].querySelector('input').checked) {
setTimeout(function(){
deliverys[1].querySelector('input').click();
}, 100);
};
st1 = true;
st2 = false;
};
};
const observer = new MutationObserver(mutationRecords => {
changeDelivery();
});
const elem = document.querySelector('.t706__cartwin-prodamount');
observer.observe(elem, {
childList: true,
subtree: true,
characterDataOldValue: true
});
})();
});
</script>
<style>
.hide-delivery{
display: none;
}
</style>