I want to add the button ADD TO CART in theme MOTION

I want to add the button ADD TO CART in theme MOTION

Wail2022
Visitor
1 0 0

Guys please help me i want to Add the BUTTON "ADD TO CART in the theme MOTION

Replies 3 (3)

oscprofessional
Shopify Partner
16402 2444 3194

@Wail2022 ,

<form method="post" action="/cart/add">
  <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
  <input min="1" type="number" id="quantity" name="quantity" value="1"/>
  <input type="submit" value="Add to cart" class="btn" />
</form>

Try this code.

 

On which pages you want to add ?

Have you checked in customizer area?

Hire us | Pass Core Web Vital | B2B Wholesale Experts | Claim Your Free Website Review |
Connect with Us: WhatsApp | Skype: oscprofessionals-87 | Email: pallavi@oscprofessionals.com |
Custom Shopify SolutionsPrivate Apps, Theme Customization & SEO | Digital Marketing |
OSCP Apps: Discount Suite | Wholesale App | Bundle & Upsell | Shipping Discount | and more...
zainaae
Visitor
2 0 0

what if we want to add "Add to cart" & "Buy now" button on every product on the website?

Jmac06
Visitor
2 0 0

What can I do if I have a Fetch API issue. I found this code, but I can't seem to get it to work when I paste it. 

 

  // Use fetch API to add the item to the cart

      fetch(url, {

        method: 'POST',

        body: formData,

      })

      .then(response => {

        if (response.ok) {

          // Redirect to the cart page after adding the item

          window.location.href = '/cart';

        } else {

          // Handle errors here (optional)

          console.error('Error adding to cart:', response.statusText);

        }

      })

      .catch(error => {

        console.error('Fetch error:', error);

      });

    });

  });

</script>