Add to cart button

A very basic example:

  • create a variable “simple-cart” of type Object default to {}

  • create a list of cards binding the items to a list of products (you need a unique id for every product). In the example I am using an array of data directly in the formula but this should be from a collection or another data source.
    image

  • to add a product create a workflow with two actions:

    1. return value, where you calculate the new amount
    2. change simple-cart variable, with the updated value
  • to remove a product create a workflow with two actions:

    1. return value, where you calculate the new amount
    2. change simple-cart variable, with the updated value
  • to get the total amount of a product in a cart:

result showing the value of the variable:
chrome_mZE5Hezawy

4 Likes