Table of Contents

Class DiscountEngine

Namespace
Dynamicweb.Ecommerce.Orders.Adjustments
Assembly
Dynamicweb.Ecommerce.dll

Represents a discount engine. To implement a custom discount engine, inherit from this class and override the ApplyDiscounts and GetProductDiscounts methods.

[Experimental("DWEX100001")]
public abstract class DiscountEngine
Inheritance
DiscountEngine
Inherited Members

Methods

ApplyDiscounts(OrderAdjustmentContext)

Is run when discounts are applied to the cart.

public abstract bool ApplyDiscounts(OrderAdjustmentContext context)

Parameters

context OrderAdjustmentContext

The current context containing the order and/or orderline where the discount is being applied to.

Returns

bool

GetFillableProperty<T>(IRenderableDiscount, string, DiscountViewModelSettings, ProductAdjustmentContext)

Returns a function that has the result for the property given. If the propertyName is not a property the discount implementing this interface has, it should return null.

public abstract Func<T>? GetFillableProperty<T>(IRenderableDiscount discount, string propertyName, DiscountViewModelSettings settings, ProductAdjustmentContext context)

Parameters

discount IRenderableDiscount

The discount to get the function from.

propertyName string

The name of the parameter from DiscountViewModel.

settings DiscountViewModelSettings

The settings for the DiscountViewModel.

context ProductAdjustmentContext

The current context for the discount.

Returns

Func<T>

A function which results in a type for the propertyName.

Type Parameters

T

The type of the propertyName in DiscountViewModel.

GetProductDiscounts(ProductAdjustmentContext)

Is run when fetching discounts for products, when fetching product prices.

public abstract IEnumerable<IRenderableDiscount> GetProductDiscounts(ProductAdjustmentContext context)

Parameters

context ProductAdjustmentContext

The context containing the product being fetched.

Returns

IEnumerable<IRenderableDiscount>
To top