Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Why Input Submiting Add To Cart Form? shopify

after i change input value, increase or decraese, form automaticly submits, and redirecting me to card page, how i can fix it?

<form action="/cart/add" method="post" class="add-to-cart-wrapper" data-productid="{{product.id}}">
          <input type="hidden" name="id" data-productid="{{product.id}}" class="product-select" value="{{ product.variants[0].id }}" data-variant-title="{{ product.variants[0].title }}" />

          <div class="add-to-cart">
            <button
                    class="upper pointer bg-green txt-white" type="submit" name="add" id="AddToCart"
                    >
              добавить в корзину
            </button>

          </div>
          <div class="price-wrapper">
            <div class="quantity-wrapper">
              <input type="number" id="Quantity"
                     name="quantity" value="1" min="1" pattern="[0-9]*"
                     class="product-form__input product-form__input--quantity" data-quantity-input
                     hidden />
              <button
                      onclick="decreaseQuantity(event)"
                      class="pointer reduce"
                      >
                <img
                     src="{{'Minimaize.svg' | asset_url}}"
                     alt="reduce icon"
                     width={{ image.width }} height={{ image.height }} loading="lazy" 
                     />
              </button>

              <div class="quantity" id="quantity">
                1
              </div>
              <button
                      onclick="increaseQuantity(event)"
                      class="pointer increase"
                      >
                <img
                     src="{{'Maximize.svg' | asset_url}}"
                     alt="increase icon"
                     width={{ image.width }} height={{ image.height }} loading="lazy" 
                     />
              </button>
            </div>
            <div class="price">{{ product.price | money}}</div>
          </div>
        </form>

why does on input change, all form is submiting and redirecting me to cart page? how can i fix it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No type is specified for the <button>:

<button
   onclick="decreaseQuantity(event)"
   class="pointer reduce"
>

The default is type="submit". Just specify that it's not a submit button:

<button
   onclick="decreaseQuantity(event)"
   class="pointer reduce"
   type="button"
>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!