Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

206
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda