In this tutorial I’ll show you how to automate updating order prices conditionally. We’ll have 3 prices. Breakfast price, Dinner price and ToGo price. Breakfast or Dinner price will apply automatically depending on time of the day. Regardless time of the day ToGo price will activate when ticket marked as ToGo.
##Configuring Prices
First we’ll define price definitions from Management > Products > Price Definitions screen.
Breakfast price will appear as BB
on ticket and bills. I’ll create another price definition for Dinner
price and tag as DN
.
I won’t create a price definition for ToGo prices as I’ll use default product prices as ToGo prices.
When I display Price List Editor I’ll see three prices for each product. I’ll use first column prices as ToGo prices. BB is Breakfast and DN is Dinner price. Update prices and click Save.
If you leave BB or DN price empty default price will be used.
After finishing defining prices I’ll create a new action to update order prices. Use Automation > Actions screen to create a new action and choose action type as Update Order
.
By using Update Order
action we can change order line values. I’ll use this action to change order’s price tag so I’m defining a variable for Price Tag
parameter.
I can use Price parameter to set a fixed price value for order but I need to read defined price for related price tag so I’m using
Price Tag
parameter.
Update Order
is a special action that works for selected orders on ticket. If there are no selected order lines on ticket it updates all order lines. When you add a new order it becomes selected while order specific rules working likeOrder Added
. So if you execute this action inOrder Added
event it updates only related order. If you execute it in a ticket rule likeTicket Closing
it updates all orders as there are no selected orders.
While defining action I’ve defined
[:Price Tag]
variable instead of typing a fixedBB
orDN
price tag value. So I can tell which price tag will apply to order line while executing this action inside a rule.
##ToGo Tickets
Tracking ToGo tickets topic is out of scope for this tutorial. We’ll use Ticket Tags to mark a ticket as a ToGo ticket. I’ll create a Toggle button to Enable / Disable ToGo ticket.
We need an action to Update Ticket’s Delivery Type
tag. It can be ToGo
or Dine in
. Create new action and set action type as Update Ticket Tag
Now we’ll create a button that toggles ticket’s delivery type.
When we enable toggle each button click executes Toggle Delivery Type
command with a command value defined in values section. Each click executes next command value. I’ll map this button to ticket on Mappings
screen.
We need to execute Update Delivery Type
action when this button clicked. I’ll create a new rule to do that.
Our default Delivery Type will be dine in so I’ll create a new Ticket Created
rule to set default Delivery Type as Dine in.
Create a new ticket to see if default Delivery Type correctly updates and if Clicking ToGo
button toggles delivery type correctly.
##Price Automation
Now we’re ready to configure how prices will change. Assume we need to update prices as…
- Default price will be used for all
ToGo
tickets. - BB (breakfast) price will be used for
Dine in
tickets until 01:00 PM (13:00). - DN (dinner) price will be used for
Dine in
tickets after 01:00 PM (13:00).
So we need to update prices…
- When a new order added to ticket.
- When delivery type toggles.
We need to update prices when delivery type toggles as operator can change delivery type after adding orders. While adding orders dine in prices will apply but when operator changes delivery type as ToGo we need to change all order’s prices.
IMPORTANT!!! Must Read: When we have multiple cases to implement it is a good idea to implement it without attaching it to a specific rule. To do this: I’ll create a temporary button that updates prices when clicked. When I ensure it works fine I’ll delete button and make it run automatically. By using this technique you can easily test if your implementation works fine and you can easily map actions to multiple rules.
I’ll create Update Prices
button and map it to Ticket.
I’m mapping it to Ticket.
You should see button here:
Now I’ll create 3 Rules that works when Update Prices
button clicked. When you add orders, change delivery type and click Update Prices
button, order prices should change accordingly.
####ToGo Price Rule
We’ll create a new Automation Command Executed
Rule that applies default prices when ticket’s delivery type is ToGo
.
I’ve used
{TICKET TAG:Delivery Type}
tag to read selected Delivery Type for ticket.
Add a single space for Price Tag parameter to leave price tag empty and apply default prices.
####Breakfast Price Rule
While applying Dine in prices we’ll also test time of day. We’ll apply breakfast prices if time is before 01:00 PM. I’ll create a new rule that applies Breakfast
(BB) prices if Delivery Type
is Dine in
and time is before 01:00 PM (13:00).
{DATE}
tag returns actual date & time. As I can define formatting for this tag I’m using it as{DATE:HHmm}
to format time as HHmm. HHmm formatting returns time in 24 hr format. So when time is 03:45 PM it returns 1545. If I need to know time is before 08:30 PM I can assume all values less than 2030 is before 08:30 PM (20:30).
Don’t forget to change constraint operator as
Matches All
.
####Dinner Price Rule
Dinner price rule is similar to Apply Breakfast Prices Rule
rule. You can duplicate it or create a new rule to define how Dinner Price rule works. This rule will work when Delivery Type
is Dine in
and Time is after 01:00 PM (13:00)
###Testing
To ensure prices updates correctly create a new ticket, set delivery type and click Update Prices
button to see if prices updates correctly. If you need to find a configuration mistake you can use Show Message
action to see how rules updates prices.
Create a new ticket and add few orders. Be sure sure you’ve configured all prices.
Clicking Update Prices
button should apply prices accordingly.
Also test if ToGo
and Breakfast
prices applies fine before automating events.
##Automation
On final step we’ll make Update Prices
button to work automatically when an order is added to ticket and when Delivery Type changes.
Updating prices after adding an order
I’ll create a new Execute Automation Command
action. This action will trigger Automation Command our Update Price
button executes.
I’ll create a new rule that executes this action when a new order line added to ticket.
We’re benefiting from how we’ve setup rules. We can trigger Update Prices
anytime we need.
####Updating prices while changing Delivery Type
You’ll remember we already created Update Delivery Type
rule to change Ticket’s delivery type as ToGo or Dine in. Now I’ll edit Update Delivery Type
Rule and add Execute Update Prices
action to update prices after delivery type changes.
##Final test
Now prices should update fine without the need of clicking Update Prices
button. If it works fine you can unmap or remove Update Prices
button to remove it from ticket screen.