title: WooCommerce add multiple products to cart programmatically
body: <p>I am writing a addon for WooCommerce. i want add multiple products to WooCommerce cart.
  this is my code.</p>
  
  <pre><code>    global $woocommerce;
  
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Intel'], $_REQUEST['Intel_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['AMD'], $_REQUEST['AMD_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Desktops_cpu'], $_REQUEST['Desktops_cpu_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Workstation_server_cpu'], $_REQUEST['Workstation_server_cpu_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['intel_Xeon_phi_PCI_Express'], $_REQUEST['intel_Xeon_phi_PCI_Express_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Memory_Ram_non_Ecc'], $_REQUEST['Memory_Ram_non_Ecc_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Memory_Ram_Ecc'], $_REQUEST['Memory_Ram_Ecc_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Desktop_graphics_card'], $_REQUEST['Desktop_graphics_card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Workstation_graphics_card'], $_REQUEST['Workstation_graphics_card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Multi_display_video_card'], $_REQUEST['Multi_display_video_card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Server_graphics_card'], $_REQUEST['Server_graphics_card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Capture_card'], $_REQUEST['Capture_card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Cooling'], $_REQUEST['Cooling_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['Sound_Card'], $_REQUEST['Sound_Card_num'] );
      $woocommerce-&gt;cart-&gt;add_to_cart( $_REQUEST['SSD'], $_REQUEST['SSD_num'] );
  </code></pre>
  
  <p>Products are added to the cart, But then I have errors!</p>
  
  <pre><code>Notice: woocommerce_items_in_cart cookie cannot be set - headers already sent by /var/www/wordpress/wp-includes/formatting.php on line 5405 in /var/www/wordpress/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 742 ...
  </code></pre>