Creating a Simple Cart in WhatsApp

Cesar Banchio Updated by Cesar Banchio

In this article we will create a simple shopping cart of a fictitious restaurant that will take our order via WhatsApp.

The flow is very simple as will look like so:

We will loop around the ordering part of the flow based on if the user wants to keep ordering or not:

At the beginning of the flow we will create 2 variables, order and sum. Order will be an array that will save the user's orders, and sum will hold the total amount the user has to pay.

We will save the order selected in a variable called menu:

So after every selection, we will add to sum the price of the order and we will push the order into the array. The formulas used are the following:

Sum(@sum, 10)

for the sum variable

Push(@order, @menu)

for the order variable

At the end of the flow, we ask the user if they want to keep ordering, if so, we use a jump to block to jump the user to the Reply Button block that has the options.

If not, we show the order array and the sum to show the total order and the total amount.

How did we do?

Notify Teammates of Chat via WhatsApp