A promotion discount provider plugin for EShop.
-
Install the following NuGet packages. (see how)
- EasyAbp.EShop.Orders.Plugins.Promotions.Domain (install at EasyAbp.EShop.Orders.Domain location)
- EasyAbp.EShop.Products.Plugins.Promotions.Domain (install at EasyAbp.EShop.Products.Domain location)
- EasyAbp.EShop.Plugins.Promotions.Application
- EasyAbp.EShop.Plugins.Promotions.Application.Contracts
- EasyAbp.EShop.Plugins.Promotions.Domain
- EasyAbp.EShop.Plugins.Promotions.Domain.Shared
- EasyAbp.EShop.Plugins.Promotions.EntityFrameworkCore
- EasyAbp.EShop.Plugins.Promotions.HttpApi
- EasyAbp.EShop.Plugins.Promotions.HttpApi.Client
- (Optional) EasyAbp.EShop.Plugins.Promotions.MongoDB
- (Optional) EasyAbp.EShop.Plugins.Promotions.Web
-
Add
DependsOn(typeof(EShopXxxModule))
attribute to configure the module dependencies. (see how) -
Add
builder.ConfigureEShopPluginsPromotions();
to theOnModelCreating()
method in MyProjectDbContext.cs. -
Add EF Core migrations and update your database. See: ABP document.
This promotion plugin module provides an easy way to define EShop's product discounts and order discounts.
Promotion type is defined to provide programs for different discount logics.
We have created SimpleProductDiscount and MinQuantityOrderDiscount promotion type definitions for you. You can define custom promotion types yourself if you need different discount logic.
Product discounts subtract the price of products before customers place an order.
For a product SKU, if there are more than one promotion offering product discounts, customers will see all of them,
but only the one with the highest discount amount will be applied,
since they have the same EffectGroup = "Promotion"
.
The promotion product discounts coexist with other types of discounts with different EffectGroup.
Order discounts subtract the price of products after customers place an order.
For an order line, if there are more than one promotion offering order discounts,
only the one with the highest discount amount will be applied,
since they have the same EffectGroup = "Promotion"
.
The promotion order discounts coexist with other types of discounts with different EffectGroup.
If your product or order has many related discounts with conflicts, EShop will find the best combination of discounts using BFS.
See these codes for more:
- ProductDiscountResolver
- OrderDiscountResolver
- DemoOrderDiscountProvider and OrderDiscountProviderTests
You can create a promotion with the preset promotion type SimpleProductDiscount. It offers direct product discounts for the products you specify.
You can create a promotion with the preset promotion type SimpleProductDiscount.
It discounts an order line if the OrderLine.Quantity >= Configurations.MinQuantity
.