This is especially useful for discounts or a shipping
calculator. Based on what items are in the users cart, you
could charge an additional amount to the order for
shipping costs.
There are three types of OrderModifiers (denoted by the
"Type" enum field below):
- 'None': This is for a state when you need to indicate
to the user an amount, but it doesn't modify the total.
(very useful for indicating tax on an order where tax
is inclusive on the products being purchased)
- 'Chargable': Charges an amount to the order. A good example
of this would be shipping costs.
- 'Deductable': Discounts an amount from the order. A good
example is a discount being offered to the customer; a
rewards scheme, or offering a 10% discount if the customer
is a VIP or frequent customer.
OrderModifiers can be as simple or as complex as needed.
{@link OrderModifier::Amount()} returns the amount to be
charged or discounted. The amount is calculated in
{@link OrderModifier::calculateAmount()} (this should be
implemented on your modifier classes).
If the OrderModifier is saved to the DB (user has checked
out), then {@link OrderModifier::Amount()} will return the
amount from the DB instead of performing a calculation.