title: Edit a cart item attribute value for Woocommerce product variations
body: <p>My cart items has 1 attribute which is "size", how can I edit that?</p>
  
  <pre><code>.......
      ["attributes"]=&gt;
        array(1) {
          ["size"]=&gt;
          string(1) "M"
        }
  .......
  </code></pre>
  
  <p>Here's the ajax function I am editing the cart items with:</p>
  
  <pre><code>add_action('wp_ajax_updateCartItem', 'updateCartItem');
  add_action('wp_ajax_nopriv_updateCartItem', 'updateCartItem');
  function updateCartItem() {
      global $woocommerce;
  
      $key = $_POST['cart_item_key'];
      $pid = $_POST['product_id'];
      $qty = $_POST['quantity'];
      $sz = $_POST['variations_size'];
  
      WC()-&gt;cart-&gt;set_quantity( $key, $qty );
  
      $data = array("success"=&gt;true,"data"=&gt;array("cart_item_key"=&gt;"$key","cart_item_subtotal"=&gt;"&lt;span class=\"woocommerce-Price-amount amount\"&gt;&lt;span class=\"woocommerce-Price-currencySymbol\"&gt;$cs&lt;/span&gt;&amp;nbsp;$pc&lt;/span&gt;","cart_total"=&gt;"&lt;span class=\"woocommerce-Price-amount amount\"&gt;&amp;nbsp;".$woocommerce-&gt;cart-&gt;get_total()."&lt;/span&gt;","cart_shipping"=&gt;"Free","quantity"=&gt;"$qty"));
  
      header('Content-Type: application/json charset=UTF-8');
      echo json_encode($data);
      die();
  }
  </code></pre>