symbios's avatar

The discounts system for e-commerce project

Hello there. I am building e-commerce project. This project has a discounts system with different discounts.

There are three kinds of discounts:

  • - PersonalDiscount
  • - OrderTotalSumDiscount
  • - PromocodeDiscount
and there is a table of discounts which has a column name `class`

I am looking for the best practices to organize this discount system. I'm considering a few variants of design patterns: Strategy, Decorator, Chain of responsibity.

The one important thing is that every discount systems could has some conditions of using:

For example if total price of order more that $2000, apply the discount, etc.

Could anybody advice me some solutions about this task. I would be happy to hear from you various options.

The database structure: http://joxi.ru/Vm6bXo3hGvjVmZ

Thank you for your answers.

0 likes
3 replies
symbios's avatar

thank you very much. I have watched it and I think this one right for me. I can provide my Order object like NullDiscount object .

Please or to participate in this conversation.