On this page

Chapter 5 · Flow and behavior

Formulas and conditions

Use variables, formulas and conditions so totals update and Pay can be blocked.

Watch the video

Video — Formulas and conditions

Follow along

Click where the blue ring is.

  1. Step 1. On the detail screen, raise the quantity and the total follows at once.

    Formulas and conditions, step 1
  2. Step 2. Quantity, price and cart count are number variables, all listed in Variables.

    Formulas and conditions, step 2
  3. Step 3. In the total text, a formula sits inside double curly braces: quantity times price, shown as a price.

    Formulas and conditions, step 3
  4. Step 4. The plus button is a Set variable reaction that adds one to the quantity, but only while it is below 9.

    Formulas and conditions, step 4
  5. Step 5. Pay now has a condition group: payment is blocked when the guest is not signed in, or the cart count is 0.

    Formulas and conditions, step 5
  6. Step 6. The group is set to Match any, so either one alone is enough to block it.

    Formulas and conditions, step 6
  7. Step 7. Play it: paying with an empty cart sends you back to the cart, and with items the order completes.

    Formulas and conditions, step 7