Hi there!
We are dealing with a business scenario for which we are trying to find a solution.
Let's work with the following assumptions:
We have 3 Items
- Item 100101
- Weight 2 lb
- Price $ 10
- Item 100102
- Weight 3 lb
- Price $ 30
- Item 100103
- Weight 8 lb
- Price $ 20
We have one Promotion at item level, with those 3 items.
And from the Business side, we want to apply a Discount for each item, based on the weight. Meaning we can have a $1 OFF per pound.
- Item 100101
- 2 lb x $ 1 = $2 OFF
- Discounted price = $10 - $2 = $8
- Item 100102
- 3 lb x $ 1 = $3 OFF
- Discounted price = $30 - $3 = $17
- Item 100103
- 8 lb x $ 1 = $8 OFF
- Discounted price = $20 - $8 = $12
I have been trying to override or create a new processor with the logic to accomplish this, but I am not finding an easy way to do it.
One of the main issues is that the object RedemptionDescription has a list of AffectedEntries, but is has only a decimal SavedAmount, which is just one amount that will be applied to all affected entries (besides is read-only).
public class RedemptionDescription
{
...
public AffectedEntries AffectedEntries { get; }
public decimal SavedAmount { get; }
...
}
Another thing I have been looking into is overriding the GetRedemptions, to return multiples RedemptionDescription, one for each item, but is getting quite complex.
Workarounds I can think of:
- Having one item per promotion
- Having one promotion at order level
Any ideas or anyone that has gone trough something similar?