title: Woocommerce WC()->cart->add_to_cart() is not working for visitors but works for logged in users
body: <p>I am developing the plugin where i am adding the products to cart by for loop as shown in the code</p>
  
  <pre><code>global $woocommerce;
  
  for ($x = 0; $x &lt; $_REQUEST['numberofproduct']; $x++) {
      $cart_item_data['unique_key'] = md5( microtime() . rand());
      WC()-&gt;cart-&gt;add_to_cart( 801, $quantity = 1, $variation_id = 802, $variation, $cart_item_data );
  }
  </code></pre>
  
  <p>When the users are logged in it cart shows the price and quantity but the users not logged in cart empty. But sometime it works visitors too. </p>
  
  <p>Can anyone help me where i am wrong?</p>