In various scenarios, certain extras should be made available for selection on a menu item only if other extras are selected. Menu Option Filtering can be used to achieve this.
CAUTION
The use of filter tags for conditional extras is typically not required for common use cases. Conditional extras are often best handled by enabling nesting in the extra group definition.
Using menu option filtering for conditional extras takes a different approach to nested extras. Menu option filtering can allow more detailed dependencies to be defined, but is significantly harder to configure and maintain. The presentation of nested extra groups in the Chewzie App is also superior.
Example Scenarios
- If I pick "Poached Egg" from an "Egg Cooking Style" extra group, it would then unhide extra options for "Soft", "Medium" or "Hard". Alternatively, if i choose "Fried Egg", it would unhide extra options for "Sunny Side Up", "Over Easy", etc.
- Milk for black coffees. For example, we might have extra options for "milk on side" or "dash of milk". Choosing either of those could then unhide extra options that give a milk choice.
While these example refer to common scenarios, these are in fact scenarios which would typically be better configured using nested extras.
Menu option filtering might be used for handling other fine-grained rules which fall outside the capabilities of nested extras.
How does it work?
Conditional extras can be achieved using advanced features of Menu Option Filters. Menu Option Filters provide allow individual extra options to be included or excluded from certain menu items based on a system of matching filter tags which are applied to both the menu items and the extra options. See Using Menu Option Filtering for instructions on the the basics of this mechanism.
Conditional Extras work by allowing certain extra options to "dynamically" apply filter tags to the items for which they are selected. Those dynamic filter tags are then used to include other extra options via the normal filter tag matching mechanism.
Configuration
To configure Conditional Extras, the appropriate Option Filtering settings must be configured in the menu. Settings will be required on:
- The menu item;
- The "trigger" extra option which enables the conditional extras,;and
- The conditional extra options themselves.
1. Menu Item
On the menu item (let's call it "Breakfast") the Filter Extra Options setting must be ticked. Without this setting, all configured extra options in the configured Extra Groups will always be shown for the menu item.
By ticking this option, only extra options added to the menu will be shown. Any others are automatically filtered out.
2. Trigger Extra Option
Apply filter tags to item when selected is the "magic" setting which enables Conditional Extras. It must be ticked on the extra option which will act as the "trigger" to enable the conditional options. In example scenario 1 at the start of this article, this might be the "Poached Egg" extra option.
Ticking Apply filter tags to item when selected means that when "Poached Egg" is selected by the user on the "Breakfast" menu item, the Filter Tags of "Breakfast" are dynamically expanded to included the "Poached" tag.
In this example, "Breakfast" does not specify any "static" filter tags. As such, it will always show the "Poached Egg" extra option, even though "Breakfast" doesn't specify the "Poached" tag. This is because "Poached Egg" has the Include on untagged items setting ticked.
If you want to combine Conditional Extras with other option filtering, you may need to add additional tags. See Combination Filtering for more on this.
3. Conditional Extra Options
We now need to set up the conditional options "Soft", "Medium", and "Hard" to only show when the "Poached" tag has been applied (which is when "Poached Egg" has been selected. This is done using normal tag matching.
The difference here is that we must ensure that Include on untagged items is unticked. The ensures that "Breakfast" will only show the conditional extra options when "Poached Egg" is selected, even though it would otherwise be "opting-out" of tag filtering.
Combination Filtering
In the example above, "Breakfast" does not specify any "static" filter tags. As such, it will always show the "Poached Egg" extra option, even though "Breakfast" doesn't specify the "Poached" tag. This is because "Poached Egg" has the Include on untagged items setting ticked.
But what if we wanted to add another filter tag to "Breakfast"? Perhaps we want to specify that limited "Cheese" extra options are available, for example. We might try something like this:
If we did that, we would find that our "Poached Egg" option was no longer available. Why? Because the filter tags of "Breakfast" do not match those of "Poached Egg", and the Include on untagged items setting can no longer save us.
We might then try adding "Poached" to the filter tags of "Breakfast":
While this would make the "Poached Egg" option available, unfortunately it would also now make "Soft", "Medium", and "Hard" also always available, because we are now statically setting a filter tag which is supposed to be dynamic.
The correct solution is to declare a third filter tag on both "Breakfast" and "Poached Egg" (as well as "Fried Egg", "Scrambled Egg", "Boiled Egg" etc.
In this way, we ensure that "Breakfast" always shows the "Poached Egg" (et al) options, but the conditional options remain conditional.
While this example refers to a combination oif static and dynamic filter tags, the issue is equally relevant for multiple static tags. In fact, once we add any static filter tags to a menu item, we generally need to add them for all filtered options, as we can no longer rely on the Include on untagged items setting.