title: How do I create a AJAX add to cart form in Woocommerce?
body: <p>I want to add the quantity to my cart and update my cart using Ajax.</p>
  <p>This is my form -</p>
  <pre><code>&lt;form action=&quot;&lt;?= esc_url( $product-&gt;add_to_cart_url() ) ?&gt;&quot; class=&quot;cart ajax_add_to_form&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
    &lt;?= woocommerce_quantity_input( array(), $product, false ); ?&gt;
    &lt;button type=&quot;submit&quot; class=&quot;btn add_to_cart_button&quot;&gt;&lt;?= esc_html( $product-&gt;add_to_cart_text() ) ?&gt;&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>