Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Quantity Selector (plus & minus) Will Not Change Quantity - Palo Alto

Solved

Quantity Selector (plus & minus) Will Not Change Quantity - Palo Alto

vavagraphics
Tourist
4 0 1

I am using the Palo Alto theme and the quantity selector plus and minus are not increasing or decreasing the quantity anymore. Not sure how to solve this issue. If anyone can help get it back on track it would be much appreciated.

 

https://actionflag.com/collections/american-flags/products/american-flag-endura-nylon-outdoor-flag-l...

Accepted Solution (1)
Huptech-Web
Shopify Partner
1010 204 217

This is an accepted solution.

Hi @vavagraphics 
Add the below code to the theme.js file. This will resolve the issue with quantity selector.

const decreaseButton = document.querySelector('.quantity__btn--decrease');const increaseButton = document.querySelector('.quantity__btn--increase');const quantityInput = document.querySelector('.quantity__input');function decreaseQuantity() {let currentValue = parseInt(quantityInput.value, 10);const minValue = parseInt(quantityInput.min, 10);if (currentValue > minValue) {currentValue--;quantityInput.value = currentValue;}}function increaseQuantity() {let currentValue = parseInt(quantityInput.value, 10);currentValue++;quantityInput.value = currentValue; }decreaseButton.addEventListener('click', decreaseQuantity);increaseButton.addEventListener('click', increaseQuantity);

 

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required

View solution in original post

Replies 5 (5)

Huptech-Web
Shopify Partner
1010 204 217

Hi @vavagraphics 
The URL you provided which show quantity dropdown not the plus minus selector & it working fine.
If you are working on the duplicate / preview theme then can you please share that URL. How to get a preview URL from duplicate theme Check screenshot
https://prnt.sc/wzcwNltiCffI Once you copy the link directly paste it here.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
Huptech-Web
Shopify Partner
1010 204 217

This is an accepted solution.

Hi @vavagraphics 
Add the below code to the theme.js file. This will resolve the issue with quantity selector.

const decreaseButton = document.querySelector('.quantity__btn--decrease');const increaseButton = document.querySelector('.quantity__btn--increase');const quantityInput = document.querySelector('.quantity__input');function decreaseQuantity() {let currentValue = parseInt(quantityInput.value, 10);const minValue = parseInt(quantityInput.min, 10);if (currentValue > minValue) {currentValue--;quantityInput.value = currentValue;}}function increaseQuantity() {let currentValue = parseInt(quantityInput.value, 10);currentValue++;quantityInput.value = currentValue; }decreaseButton.addEventListener('click', decreaseQuantity);increaseButton.addEventListener('click', increaseQuantity);

 

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
vavagraphics
Tourist
4 0 1

@Huptech-Web Thank you for your help! This one has been bothering us!

dabello1125
Visitor
1 0 0

Does this work with the Dawn theme? I am having the same issue. When customers try to adjust the quantity on the product page by clicking up or down, the page will automatically refresh and put the quantity back to 1. The quantity can be successfully changed in the cart though.

 

I cannot, however, find theme.js in my code editing area. I also have a login app to hide pricing from non-registered customers and a wholesale app that allows for wholesale and customer specific pricing discounts. 

 

my website is www.modernendoscopeparts.com - here is a sample product: https://www.modernendoscopeparts.com/products/biopsy-channel-2-8mm-id-x-1850mm-l-white-with-no-sprin...