**Scenario: Cooperative Pricing System**

Your cooperative has two margin rules:

#. **Price Category Discount:** "Cesta Básica" products get -5% (to make them affordable)
#. **Product Category Markup:** "Repostería" products get +25% (higher margin category)

**Without this module (compound):**

::

  Product: Flour (cesta básica, repostería)
  Purchase price: 4.68€
  After price category (-5%): 4.446€
  After product category (+25%): 5.5575€
  ❌ Wrong effective margin: 18.8%

**With this module (total margin enabled):**

::

  Product: Flour (cesta básica, repostería)
  Purchase price: 4.68€
  Total margin: -5% + 25% = 20%

  Option 1 - Markup:
    Final price: 4.68 × 1.20 = 5.616€ ✅ Markup 20% on cost

  Option 2 - Commercial Margin:
    Final price: 4.68 / 0.80 = 5.85€ ✅ Margin 20% on PVP

**Which method to choose?**

* **Markup (on cost):** Traditional markup calculation, margin on cost base
* **Commercial Margin (on PVP):** Retail/commercial margin, ensures exact margin percentage on final price

**Monitoring and Debugging:**

* Enable debug mode to see detailed price calculation logs
* Check logs for [TOTAL_MARGIN] tagged messages
* Verify total margin calculations match expectations
* Use global limits to enforce business rules
