Files
wyczarujprezent.pl/modules/pdfreedeliveryleftamountpro/views/js/scripts_17.js
2024-10-28 22:14:22 +01:00

40 lines
1.3 KiB
JavaScript

$(document).ready(() => {
// console.log('PRE RUN > updatedCart');
prestashop.on('updatedCart', function (event) {
//console.log('RUN > updatedCart');
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: pdfreedeliveryleftamountpro_ajax_link,
async: true,
cache: false,
data: 'action=calculateFreeDeliveryLeftAmount',
success: function(jsonData) {
data = JSON.parse(jsonData);
if (data.free_ship_from == 0) {
$('.pdfla-cart').each(function(index, value) {
$(this).addClass('hidden');
});
} else {
$('.pdfla-cart').each(function(index, value) {
$(this).removeClass('hidden');
});
$('.pdfla-delta-price').each(function(index, value) {
$(this).text(data.delta_display);
});
$('.pdfla-start-from-price').each(function(index, value) {
$(this).text(data.free_ship_from_display);
});
}
}
});
});
});