AForms Eats uses a unique method called “Labeling Logic” to achieve Conditional Branch.
The basic idea is to “look at the contents of the form entry, and if the conditions are met, attach a label to the user”.
Then, the form parts are controlled by looking at the labels on the user.
It would be easier to explain with actual examples, so here are some examples.
Example 1: Allows orders only if the price is over a certain amount
For example, a logic such as “Order is available from $20”.
From the perspective of form building, this can be rephrased as: “If the order price is less than $20 , abort the form submission”.
In this case, first, the order price is monitored with “Price Watcher”. The upper limit is set to “20”, it is set to “not included”, and the label is set to “small-order”.
This means, “Put a small-order label on the user if the order price is less than $20”.
Next, the Stop item is used to achieve the interruption.
Please set the message as “Please order more than $20”. and the required label is set to “small-order”.
This means, “If there is a small-order label on the user, abort the form submission and display a message”.
The synergy of these two components allows the achievement of “orders from $20”.
The process of Labeling Logic proceeds from top to bottom.
So, please make sure to place the Stop item (the component that watches the label) below the Price Watcher (the component that attach the label).
Example 2: Makes the delivery fee free only if the price is over a certain amount
For example, the logic would be like, “Free shipping on orders of $30 or more”.
This can be rephrased from the perspective of form building: “If the order price is less than $30, add a details line for $5 delivery fee”.
As in Example 1, first, the order price is monitored with Price Watcher.
Please set the upper limit to “30”, the upper limit to “not included”, and the label to “small-order”.
This means, “Put a small-order label on the user if the order price is less than $30”.
Next, let’s set up a Auto Item so that the details line is automatically added.
Please set the name to “delivery fee”, the price to “5”, and the required label to “small-order”.
This means, “If there is a small-order label on the user, add a details line with a delivery fee of $5.
The synergy of these two components allows the achievement of “Instead of $5, free shipping on orders of $30 or more”.
Label Specifications
- The characters that can be used for labels are alphabets, numbers, hyphen “-“, and underscore “_”.
Spaces ” ” before or after the label will be removed from the label name. - When writing multiple labels, please separate them with a comma “,”.
Conclude
It may seem that complex logic does not fit in with orders at restaurants.
However, in many cases, a conditional branching is required for online ordering or services related to home-delivery.
Labeling Logic is a great way to build the order form you want.
With the paid AForms Eats PRO, you can also build logics to change the delivery fee based on the delivery destination, or to offer a discount for take-out but not home-delivery.
We would like to explain that in the future as an advanced article.