1

is it possible to add 2 items to a cart at the same time? like a free product that is associated with a specifically selected product?

I currently add to the cart this way

$.get('/?post_type=product&add-to-cart=' + productId, function() {
   // stuff here..
});

If its not possible do you know what hooks i might need to hook into to change it?

Thanks in advance..

TheNickyYo
  • 2,389
  • 5
  • 20
  • 28
  • Why not make a $.get for both IDS, so you will end with 2 gets, also you can wait till all those get are done this way: http://stackoverflow.com/questions/9898813/jquery-wait-till-multiple-get-requests-are-successully-processed – rgdesign Feb 18 '14 at 01:20

1 Answers1

0

There may be some theme resources that load some data with same URL including the query string, which is making WP INIT function to add product another time.

My solution is to add following code in the header.php of theme before any HTML prints out: if(isset($_GET['add-to-cart'])){ //checkout can be replaced with any slug header('Location: '.site_url().'/checkout/'); exit; }