I have an item with the following data :
var item = {
id : 124,
name : xxx,
price : 13.13,
quantity : 1,
options : {
size : xl,
color: pink
}
};
When the user clicks on Add to Cart I'd like to make an Ajax Request using the WC API and add the above item to the Cart.
jQuery.ajax({
url: some/woocommerce/api/add/to/cart/request/path,
data: item,
type: POST
});
Then on the Cart Page I'd like to make another Ajax Request using the WC API and retrieve the contents of the cart.
I haven't found any documentation (official or unofficial) on how to do that from the client using Javascript.
Does anyone know and can provide me with an example please?
Also, does anyone know why the WooCommerce Api Documentation is so horrible (lacking any kind of information regarding obvious/standard questions like the above). I'm seriously thinking of having our company switch to Shopify.