Want to know how to add products to the cart with CoCart? Checkout these examples below.
Simple products are exactly that. Just the product ID and the quantity are required.
Notice for a variable product you pass along the attribute the customer selected too. Variable products may have more than one attribute and some variations maybe set to allow attributes to be open to any option so passing along the attribute the customer selected is always best with multiple options.
When adding the attribute make sure you start the key with
attribute_pa_ followed by the attribute slug of the option selected and then the value.
The best and only REST API for the frontend of WooCommerce. Build your headless store today and join a fast growing community of developers to help you out.
Mon - Friday 10am to 6pm GMT+1
All Rights Reserved