Skip to content

Latest commit

 

History

History

Promotions

EShop.Plugins.Promotions

ABP version NuGet NuGet Download Discord online GitHub stars

A promotion discount provider plugin for EShop.

Installation

  1. 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
  2. Add DependsOn(typeof(EShopXxxModule)) attribute to configure the module dependencies. (see how)

  3. Add builder.ConfigureEShopPluginsPromotions(); to the OnModelCreating() method in MyProjectDbContext.cs.

  4. Add EF Core migrations and update your database. See: ABP document.

Concepts

This promotion plugin module provides an easy way to define EShop's product discounts and order discounts.

Promotion Type

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 Discount

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 Discount

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.

The Best Combination of Discounts

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:

Usage

Create a Promotion for Product Discounts

You can create a promotion with the preset promotion type SimpleProductDiscount. It offers direct product discounts for the products you specify.

SimpleProductDiscount

Create a Promotion for Order Discounts

You can create a promotion with the preset promotion type SimpleProductDiscount. It discounts an order line if the OrderLine.Quantity >= Configurations.MinQuantity.

MinQuantityOrderDiscount