Please view the CoCart documentation for more accurate and up to date guide.
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.