Change quantity via jQuery and disabile quantity field
I have products where I need to disable the quantity field on the product detail pages and dynamically change the quantity based on another value.
I change the value using this code:
if (jQuery('body').hasClass('is-adapt-quantity-product')) {
jQuery('.wc-pao-addon-custom-textarea').bind('keyup', _.debounce(function(){
jQuery(.qty).val(parseInt(jQuery(this).val().length));
}, 500));
}
This works fine. The quantity changes and if I click on the add to cart button, I have the quantity in my cart.
When I add this to the js code:
jQuery(.qty).attr(disabled, disabled);
The quantity on the product detail page changes. However when I add the product to the cart, it adds always just the quantity of 1.
Does anybody know why this happens and how I can prevent this from happening? I want to disable the quantity field, because the field should be changes dynamically...