Shopify themes, liquid, logos, and UX
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.
Solved! Go to the solution
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);
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.
@Huptech-Web Thanks for the help. The preview link is here: https://xyel521zex0uz98x-74695311650.shopifypreview.com
Direct product here: https://xyel521zex0uz98x-74695311650.shopifypreview.com/collections/outdoor-american-flags/products/...
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);
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...
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024