Open craigmarcussen opened 1 day ago
I just tried a few experiments. It looks like that page doesn't handle an update on the submission of the form - the click event of the Update button has to happen. So if you're trying to do things with a form submit, that might be the cause.
Or maybe your override has inadvertetly removed the click handling of the Update button, and it's fallen back to submitting the form.
I can do this in a javascript console, for example (ignoring the fact I'm updating all quantities):
$('.store-product-qty').val(2);
then I can
$('.store-btn-cart-list-update').click();
Beyond that, I might need to take at look at your override.
Thanks for the reply.
As soon as I read your response, I realized my mistake. I was targeting $('.store-qty-container').find('input')
instead of $('.store-qty-container').find('.store-product-qty')
, not realizing that there was a hidden input child as well. Even though it was updating the visible qty input field, the qty field was reverting back to the original value when I hit the UPDATE CART button. Once I made the change to my JS, it worked as expected.
Again, thank you for the prompt reply, and have a great week/weekend.
Hello,
I am trying to add + and - buttons around the quantity fields on the cart page and modal (see attached image). In this case, I have created a
cart.php
page override, and I added the markup for the buttons. I also added some JS to update the value in the respective quantity field when either of the buttons are clicked. However, when I click the Update Cart button, the quantity field value snaps back to the previous amount, and will only be respected when I change the field manually. I also get the warning message "Due to stock levels your quantity has been limited", even if there is an unlimited amount in stock.Can you direct me on how I can update the value of the field with the external buttons?
Thanks, Craig