Developer forum

Forum » Ecommerce - Standard features » Staff discount rules

Staff discount rules

Simen
Reply

Hi guys,

We have a customer on DynamicWeb 10 who wants to offer a 50% staff discount on all products, but with a maximum total discount value of NOK 8,000 per customer per year.

The webshop is being built on DynamicWeb 10 eCommerce.

What would be the best way to set this up in standard DynamicWeb?

Thanks


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

This scenario can be partially handled with DynamicWeb 10's built-in discount engine, but the annual per-customer cap requires a small custom extension. Here's how we'd approach it:

Part 1 — 50% staff discount (out-of-the-box)

  1. Create a Staff user group in Back Office (Users > User Groups).
  2. Assign all staff customer accounts to that group.
  3. Create a Discount (eCommerce > Discounts) with:
    • Type: Percentage — 50%
    • Apply to: All products
    • Condition: User group = Staff
    • Valid from/to: set to the relevant year window if needed

This covers the core requirement with no custom code.

Part 2 — NOK 8,000 annual cap per customer (custom extension)

DW10 does support a global discount usage limit (MaximumLimits), but this is a shared cap across all users — not per customer. There is no out-of-the-box setting for a per-customer annual spend cap.

The clean solution is a custom DiscountExtenderBase that also implements IDiscountExtenderCalculateOrderDiscount. This is a supported extensibility hook in DW10's discount engine. The extender would:

  1. Read the current user's ID from the order.
  2. Query all completed orders placed by that user since 1 January of the current year.
  3. Sum the discount amounts already granted by this specific staff discount.
  4. Calculate the remaining budget (NOK 8,000 minus discounts already given).
  5. Return min(calculated 50% discount, remaining budget) as the final discount amount — meaning the discount is automatically capped when the limit is reached, and partial discount is applied when the customer is close to the limit.

The extender is attached directly to the discount record in Back Office (no deployment required beyond the DLL), and the configured NOK 8,000 limit can be exposed as an add-in parameter so it can be adjusted without code changes.

 

You must be logged in to post in the forum