i’ve figured out that is possible to add a product to cart with these lines:
global $woocommerce;
$woocommerce->cart->add_to_cart($product_id);
My question is, how to add a product to cart from outside? I have a simple php site, just want to delegate the sales to wordpress/woocommerce.
Can i do it with the Api?
Can you point me in th right direction?
If you want to add a product to the cart from outside of wordpress you can simply add a query on the end of your url, it will need to look like this:
http://YOURWEBSITE/?add-to-cart=PRODUCTID
where
PRODUCTID
is the id of the product you want to add to your cart.I hope this helps?