How to add %50 discount button?

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.

1. Add %50 Discount action

This action updates order price to half price.

Action Type: Update Order
Price: [=Order.Price / 2]

2. Cancel Discount

This action updates Order Price to Portion Price

Action Type: Update Order
Portion Name: [=Order.PortionName]
Price Tag: [=Order.PriceTag]

3. Update Order Discount State

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"

%50 Discount Button

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

  1. Change Visibility to "Order Line"
  2. Enabled states should be * so button will be enabled on all cases.
  3. We want to display this button if this discount not applied before. So the Discount State of the order should be empty. Type DStatus= there. That means DStatus value should be empty.

Cancel Discount Button

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.

Discount Adding Rule

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.

Discount Removing Rule

Similar to Discount Adding Rule but it handles Cancel Discount command and Update Order Discount State action clears order's discount state.

That's All !



We have already answers to
1029 questions
E-Posta Facebook Twitter RSS Skype
Telefon (212) 252 0634