Works after 3.04 Beta
You can visit Adding Discounts to Orders with Order Tags documentation for alternative (and simpler) implementation.
Hello. On this tutorial we'll add %50 discount button for orders. It will also be a good demonstration of new V3 “Order States” feature. I'll start with sample database.
We'll start by adding required actions.
This action updates Order Price to Portion Price
Action Type: Update Order Portion Name: [=Order.PortionName] Price Tag: [=Order.PriceTag]
This action changes discount state of the order. We'll set values from Discount rule.
State Name: DStatus Group Order: 3 Current State: [:Current Status] State: [:Status] State Order: 3 State Value: [:Value]
Group Order and State Order values is used to sort order state listings.
These are the needed actions. Now we'll create two Automation Commands. One of them will display “%50 Discount” button and the other button will be “Cancel Discount”
Create a new Automation Command and name it as “%50 Discount”. Button Header is the button label visible to user. Choose a color if needed and switch to Mappings page.
Add a new mapping and
When a discount applied we'll need another button to cancel that discount. Create a new Automation Command, name and color it as you need. Switch to Mappings Page.
When we apply discount we'll change Order Discount State to %50 Off value so we need to display that button when Order State is %50 Off
You can also change User Role, Terminal and Department mappings for finer control on this feature.
Finally we'll wire automation commands with actions. We'll need two Rules.
Create a new rule and handle Automation Command Executed Event. Select AutomationCommandName as %50 Discount and choose Add %50 Discount and Update Order Discount State actions.
Also switch to Mappings page and add a default map.