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

Re: Quantity drop down selector only adds 1 to cart and doesnt see choice selected

Quantity drop down selector only adds 1 to cart and doesnt see choice selected

Brad38
New Member
8 0 0

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:

 

<div class="product-form__controls-group">
<div class="product-form__item">
<p align="center"><font size="5">
<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
<select>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 %}
<option value="{{ i }}">{{ i }}</option>
{% endif %}
{% endfor %}
</select>
</font> </p>
</div>
</div>

 

 

 

Any help or advice is appreciated.

 

Brad

Replies 3 (3)

BSSCommerce-TA
Shopify Partner
124 24 24

Hi @Brad38 ,

I fixed it  :

 

<div class="product-form__controls-group">
<div class="product-form__item">
<p align="center">
<font size="5">
<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
<select 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 %}
<option value="{{ i }}">{{ i }}</option>
{% endif %}
{% endfor %}
</select>
</font>
</p>
</div>
</div>

 

 

The cause of the error

Select Tag Issue: The <select> 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 <select>

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.

SIMICART: Mobile App Builder |Ironwork Theme - Coming Soon | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency

Guleria
Shopify Partner
3688 741 1038

Hello @Brad38 ,

 

Check the select tag:

<div class="product-form__controls-group">
<div class="product-form__item">
<p align="center"><font size="5">
<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
<select 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 %}
<option value="{{ i }}">{{ i }}</option>
{% endif %}
{% endfor %}
</select>
</font> </p>
</div>
</div>
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Brad38
New Member
8 0 0

That works. It is populating the cart correctly. 

The popup cart notification is still wrong. 

Can you help me with correcting that too.

 

Brad

 

Screenshot (2036).png