Inputed quantity in box increase Cart quantity only by 1

Solved
slawa
New Member
6 0 0

Hi!

I want to use number input field on Quantity instead of default quantity selector (with variants).

Currently: Number (e.g "6") inputted in quantity box increase Cart only by 1.

 

I am not good developer skills, and will be very grateful for help!

 

Form code is below:

 

<form action="/cart/add" method="post" enctype="multipart/form-data" id="AddToCartForm">
          <div class="selector-wrapper-secton">
            {% if settings.enable_color_swatch %}           
            {% for option in product.options %}
            {% include 'swatch' with option %}
            {% endfor %}
            {% endif %}              
            <select name="id" id="productSelect" class="singlepro__variants">
              {% for variant in product.variants %}
              <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} value="{{ variant.id }}">{{ variant.title }}</option>
              {% endfor %}
            </select>
            </div>      

          
         <div class="singlepro__quantity {% unless settings.product_quantity_enable %} hide {% endunless %}">
            <div class="quantity-box-section">
            <label>{{ 'products.product.quantity' | t }}</label>
<input min="1" type="number" id="quantity" name="quantity"/>
<style>
  #quantity {
    padding: 8px;
    width: 55px;
    border: 1px solid #000;
    border-radius: 4px;
  }
</style>
                </div>
             </div> 
         
            {% if settings.enable_add_cart %}
            <button type="submit" name="add" id="AddToCart" class="btn pull-left procart">
              <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
            </button>
            {% endif %}         
        </form>

 

 

Maybe there is dependence in script, but i am not sure. 

 

<script>
  var selectCallback = function(variant, selector) {
    timber.productPage({
      money_format: "{{ shop.money_format }}",
      variant: variant,
      selector: selector,
      translations: {
      add_to_cart : "{{ 'products.product.add_to_cart' | t }}",
      sold_out : "{{ 'products.product.sold_out' | t }}",
      unavailable : "{{ 'products.product.unavailable' | t }}"
    }
  });

 

 

0 Likes
coolyx
Excursionist
17 3 4

Can I have your store URL in order to have a check?

Shopify Partner
https://www.mojoin.com
0 Likes
slawa
New Member
6 0 0

Yep, ofc

url: teamail.pl

pass (right top corner button): raigin

0 Likes
gina-gregory
Shopify Expert
710 48 175

This is an accepted solution.

There is code in the shop.js file in your theme that adds the item to the cart. It's looking for the quantity as a <select> element, not a number input.

Screen Shot 2021-01-04 at 10.32.11 AM.png

You can remove the 'select' part and just look for '[name=quantity]'

coolyx
Excursionist
17 3 4

Sorry, Can't see your store url

Shopify Partner
https://www.mojoin.com
0 Likes
slawa
New Member
6 0 0

Thank you!

Its work as expected now.

0 Likes
slawa
New Member
6 0 0

Hi!

Maybe you could help me again.  How could i save both variant of input?

I want to use input field and selector (it will be depends on product.type)

Снимок экрана 2021-01-07 в 19.04.41.png

I've tried to add new "var" in the same way with select method, but it was not work.

Снимок экрана 2021-01-07 в 19.08.29.png

 

0 Likes