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..
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;
}