Skip to content

Promotion usageLimit and perCustomerUsageLimit ignored for auto-applied promotions without couponCode #4353

@Ryrahul

Description

@Ryrahul

Describe the bug
usageLimit and perCustomerUsageLimit are ignored for promotions that do not have a couponCode.

Auto-applied promotions (without a coupon code) can be used an unlimited number of times, even when usage limits are configured in the Admin UI. Usage limits are only enforced when a coupon code is explicitly applied via applyCouponCode().

This results in inconsistent behavior between coupon-based promotions and auto-applied promotions.


To Reproduce
Steps to reproduce the behavior:

  1. Go to Admin UI → Promotions
  2. Create a new promotion without a coupon code
  3. Set:
    • usageLimit = 1
    • perCustomerUsageLimit = 1
  4. Add a condition so the promotion auto-applies (e.g., minimum order value)
  5. Place multiple eligible orders
  6. Observe that the promotion continues to apply beyond the configured limits

Expected behavior
Promotions should respect usageLimit and perCustomerUsageLimit regardless of whether a couponCode is configured.

Alternatively, if usage limits are intentionally meant to apply only to coupon-based promotions, this should either:

  • Be clearly documented, or
  • Be prevented at the Admin UI level for non-coupon promotions.

Actual behavior
Usage limits are only enforced inside PromotionService.validateCouponCode(), which is called exclusively when applying a coupon via OrderService.applyCouponCode().

Auto-applied promotions follow this flow:

OrderService.applyPriceAdjustments()
OrderCalculator.applyPromotions()
Promotion.test()
Promotion.apply()

Promotion.test() checks:

  • start/end dates
  • coupon presence (if defined)
  • promotion conditions

However, it does not check usageLimit or perCustomerUsageLimit.

As a result, auto-applied promotions never enforce usage limits.



  • @vendure/core version: 3.5.3
  • Database: PostgreSQL
  • Operating System: macOS
  • Package manager: yarn

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions