Hello,

When you dynamically set a value in a textfield using jQuery .val(), you have to manually trigger the .change event if you want to add extra code that trigger when the value of the field change.

To do that, in commerce_extra_quantity.js, just change

    // Set new quantity
    if (new_quantity >= 1) {
      $(selector).val(new_quantity);
    }

By

    // Set new quantity
    if (new_quantity >= 1) {
      $(selector).val(new_quantity).change();
    }

Like that, you can use things like that in your own custom code for extra customization :

$('.form-item-quantity input').change(function() {
  // Some extra jquery code here
});

Without that small change, it's impossible to add extra code depending on the value change of that field (or it will trigger only if the user manually change the field, but not when he click on plus or minus buttons

Comments

5n00py’s picture

Status: Needs review » Closed (duplicate)