Tech Articles‎ > ‎Point of Sale‎ > ‎

Creating two discounts in a single button

There are times when you may want to have a single button fire off multiple discounts, an example might be when employees get 10% off some products and 15% off others.  To do this you need to create two separate custom discounts to identify each group of products and the desired discounts and then wrap them into a button using the compose command (click here to see an article on using commands)

An example might look like this:
[{
Command: 'CloudRetailer.Plugins.Discounting.Pos.PerformCustomDiscount',
Parameter: 
"{
Range: 'All',
CustomDiscountId: '8a1cae30-afcd-49c3-a136-19d4912691fa'
}"
},{
Command: 'CloudRetailer.Plugins.Discounting.Pos.PerformCustomDiscount',
Parameter: 
"{
Range: 'All',
CustomDiscountId: '3774606b-1d74-4860-8134-19d49144a4a0'
}"
}]

When you test your button you'll notice that one discount fires but the other does not.  This is intentional, the second discount overrides the first but you can use the "ApplySeparately" parameter to change this behavior.  Here's the same command using this method:

[{
Command: 'CloudRetailer.Plugins.Discounting.Pos.PerformCustomDiscount',
Parameter: 
"{
Range: 'All',
CustomDiscountId: '8a1cae30-afcd-49c3-a136-19d4912691fa',
        ApplySeparately: true
}",
},{
Command: 'CloudRetailer.Plugins.Discounting.Pos.PerformCustomDiscount',
Parameter: 
"{
Range: 'All',
CustomDiscountId: '3774606b-1d74-4860-8134-19d49144a4a0',
        ApplySeparately: true
}",
},{
Command: 'CloudRetailer.Plugins.Discounting.Pos.PerformCustomDiscount',
Parameter: 
"{
Range: 'All',
CustomDiscountId: 'eac1b021-4db8-4e3b-9e31-19d9b0163dbe',
        ApplySeparately: true
}"
}]



RITE internal reference: https://app.asana.com/0/766331960665/551999773337406

Comments