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.
-
to add a product create a workflow with two actions:
- return value, where you calculate the new amount
- change
simple-cart
variable, with the updated value
- return value, where you calculate the new amount
-
to remove a product create a workflow with two actions:
- return value, where you calculate the new amount
- change
simple-cart
variable, with the updated value
- return value, where you calculate the new amount
-
to get the total amount of a product in a cart:
result showing the value of the variable: