Webshop-06-Pricing-and-Discounts
Appearance
06 - Pricing & Discounts
Parent: [Webshop-Index Webshop Index] Previous: [Webshop-05-Variant-Selector 05 - Variant Selector] Next: [Webshop-07-Checkout-and-Orders 07 - Checkout & Orders] Source: Comfac Webshop Wiki - Chapter 06
Pricing Architecture
ERPNext's pricing engine handles all calculations:
1. Price List - Base prices per item 2. Pricing Rules - Discounts based on conditions (qty, customer, date range, etc.) 3. Coupon Codes - Additional discounts via codes 4. Tax Rules - Tax calculation
The webshop reads the results of these calculations but does not implement the logic itself.
Discount Calculation Flow
1. User adds item to cart 2. cart.py:apply_cart_settings() calls set_price_list_and_rate() 3. ERPNext pricing engine: - Reads Price List for base price (price_list_rate) - Checks Pricing Rules for discounts - Applies discount to get rate 4. calculate_taxes_and_totals() computes: - item.amount = rate * qty - doc.total = sum of all item.amountKey Pricing Fields on Quotation
| Field | Location | Contains |
price_list_rate
|
Quotation Item | Original price from Price List |
rate
|
Quotation Item | Final price after discount |
discount_percentage
|
Quotation Item | % discount applied |
discount_amount
|
Quotation Item | Fixed discount amount |
amount
|
Quotation Item | Line total (rate * qty) |
total
|
Quotation | Sum of all item amounts |
net_total
|
Quotation | Total after item-level discounts |
discount_amount
|
Quotation | Additional order-level discount |
grand_total
|
Quotation | Final total with taxes |
coupon_code
|
Quotation | Applied coupon code |
Missing: Discount Visibility
Navigation: [Webshop-Index Webshop Index] | [Webshop-05-Variant-Selector Previous: 05 - Variant Selector] | [Webshop-07-Checkout-and-Orders Next: 07 - Checkout & Orders]