Adding products to the cart

Want to know how to add products to the cart with CoCart? Checkout these examples below.

Simple Product

Simple products are exactly that. Just the product ID and the quantity are required.

Variable Product

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.