Brad38
June 14, 2024, 9:18pm
1
I changed the qty selector to a Drop down box and got it to populate with only numbers for inventory on hand like i want it to. My problem is no matter what value is selected from the drop down list. It always adds just 1 qty to the cart.
My website is : https://rsabventures.com/
The code i have for the qty box on the product-template is:
{{ 'products.product.quantity' | t }}
name="quantity" id="Quantity-{{ section.id }}">
{% assign selected_variant = product.selected_or_first_available_variant %}
{% for i in (1..selected_variant.inventory_quantity) %}
{% if i <= selected_variant.inventory_quantity %}
{{ i }}
{% endif %}
{% endfor %}
Any help or advice is appreciated.
Brad
Hi @Brad38 ,
I fixed it :
{{ 'products.product.quantity' | t }}
{% assign selected_variant = product.selected_or_first_available_variant %}
{% for i in (1..selected_variant.inventory_quantity) %}
{% if i <= selected_variant.inventory_quantity %}
{{ i }}
{% endif %}
{% endfor %}
The cause of the error
Select Tag Issue: The tag was not properly closed. I’ve corrected this in the code above by placing the name and id attributes within the opening tag of
Brad38
June 15, 2024, 1:27pm
4
That works. It is populating the cart correctly.
The popup cart notification is still wrong.
Can you help me with correcting that too.
Brad