An order may contain one or more discounts, represented as order rows of type Discount.
Discount row overview
Discount rows
DiscountInfo::ReturnsAllowed
If the ReturnsAllowed ==false
Discounts for the order are recorded as order rows. They have the type OrderRowType::Discount
A discount row may be associated with a product Row, a Fee row, or a shipping fee row. When they are associated with Product, Fee, or ShippingFee row, the association is recorded in the following way.
Please see all details in a full-size diagram of discounts data modeling here or click to enlarge the image below.
DiscountInfo::SourceOrderRowSystemIds contain the list of order rows because of which a discount row specified by the DiscountInfo::ResultOrderRowSystemId is added. Therefore, for a given discount row, it can be tracked, to which order row(s) the discount is given.
1. Order rows which has OrderRow::OrderRowType set to OrderRowType ::Discount are discount rows. These rows have negative prices and quantity is always 1.
2. For a given discount, a separate row is added to represent the discount amount.
3. For product discounts, the original prices for the products are recorded as product order rows, and the discounts given for them are recorded as discount order rows.
- Example: Suppose a 3 for 2 discount for product X. Say, Product X unit price is 100 SEK. Suppose the buyer buys quantity 3 of X. Then, it results in the following two order rows in the order.
- Order row of type OrderRowType::Product has 3 units of X at a unit price of 100 SEK.
- Order row of type OrderRowType::Discount has a discount of -100 SEK (corresponding to the 3 for 2 discount)
- Example: Suppose a product Y special discount price of 99 SEK, and the original price is 100 SEK. This results in the following two order rows.
- Order row of type OrderRowType::Product has 1 unit of Y at a unit price of 100 SEK.
- Order row of type OrderRowType::Discount has a discount of -1 (corresponding to the specail price 99 SEK)
There can be multiple discount rows for a given product row. However, a given discount row is specifically pointing to one product row when it is a product discount. If it is an order level discount, DiscountInfo::SourceOrderRowSystemIds will be empty., indicating that it concerns all the entire order.
Indicates whether the discount is valid even if the corresponding order row items are returned.
Example: Suppose an order grand total is 1000 SEK, and it includes free shipping. The shipping fee is 100 SEK.
In total, the customer has paid 1000 SEK for this order, which includes a -100SEK free shipping discount.
Suppose the whole order is returned.
If for the discount row, the ReturnsAllowed == true, the customer gets a 1000 SEK refund.
customer gets a 900 SEK refund.
- The free shipping discount row is not considered when the refund amount is processed, because its ReturnsAllowed attribute is false.
- The order as of now (before the current returned items) is re-evaluated without the free shipping discount, and it becomes 1100 SEK (the discount cannot be applied because of the return).
- As per the order as of now, the customer has only paid 1000 SEK, but the new total is 1100 SEK. There is a due -100SEK.
- When refunding the customer 1000 SEK, this -100SEK is now deducted as the due amount, resulting in a 900 SEK refund.
Exceptions to normal rules
There can be instances the full refund is processed, irrespective of the ReturnsAllowed property. For example, when the items delivered are faulty or some other merchant error, the shipping cost may also be refunded to the buyer. These rules are configured as part of "return management"