title: Update cart with WooCommerce ajax
body: <p>In my woocommerce website, I have changed the cart page, removed the button "update cart" and create 2 buttons to add and remove items of product like I show in this picture:</p>
  
  <p><a href="https://i.stack.imgur.com/txZtL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/txZtL.png" alt="enter image description here"></a></p>
  
  <p>When I click on the quantity buttons I want to call the same function if I press the button to update the cart.</p>
  
  <p>For this I am using ajax but it doesn't do anything.</p>
  
  <p>First in my <code>function.php</code> file I have this:</p>
  
  <pre><code>  function update_my_cart() {
      // here update then cart
      var_dump("execute");
    }
    add_action( 'wp_ajax_update_my_cart', 'update_my_cart' );    // If called from admin panel
    add_action( 'wp_ajax_nopriv_update_my_cart', 'update_my_cart' );  
  
  
  
      add_action( 'wp_enqueue_scripts', 'rct_enqueue_scripts' );
  
      if ( ! function_exists( 'rct_enqueue_scripts' ) ) :
  
      function rct_enqueue_scripts() {
      wp_enqueue_script( 'rct-js', get_template_directory_uri() . '/js/themeCoffee.js', array(), '1.0', true );
      wp_localize_script('rct-js', 'ajax_object', array('ajax_url' =&gt; admin_url( 'admin-ajax.php' )));
      }
  
      endif;
  </code></pre>
  
  <p>And in my jquery file I have this: </p>
  
  <pre><code>  updatecart = function(qty) {
      var currentVal, data, item_hash, request;
      currentVal = void 0;
      data = void 0;
      item_hash = void 0;
      currentVal = parseFloat(qty);
      request = $.ajax({
        url: 'ajax_object.ajax_url',
        method: 'POST',
        data: {
          quantity: currentVal,
          action: 'update_my_cart'
        },
        dataType: 'html'
      });
      request.done(function(msg) {
        alert('cart update ');
      });
      request.fail(function(jqXHR, textStatus) {
        alert('Request failed: ' + textStatus);
      });
    };   
  </code></pre>
  
  <p>I obtain this error:</p>
  
  <pre><code>Failed to load resource: the server responded with a status of 404 (Not Found)
  </code></pre>
  
  <p>Because I try to load <code>my_website/cart/ajax_object.ajax_url</code>.</p>
  
  <p>Thanks in advance!</p>