jQuery(document).ready(function($) {
// On force l'écoute du clic sur les boutons spécifiques de votre thème
$(document).on('click', '.nm-qty-plus, .nm-qty-minus', function() {
var $qty = $(this).closest('.quantity').find('.qty'),
currentVal = parseFloat($qty.val()),
max = parseFloat($qty.attr('max')),
min = parseFloat($qty.attr('min')),
step = $qty.attr('step');if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;
if (max === '' || max === 'NaN') max = '';
if (min === '' || min === 'NaN') min = 0;
if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1;if ($(this).is('.nm-qty-plus')) {
if (max && (currentVal >= max)) {
$qty.val(max);
} else {
$qty.val(currentVal + parseFloat(step));
}
} else {
if (min && (currentVal 0) {
$qty.val(currentVal - parseFloat(step));
}
}
$qty.trigger('change');
});
});