Skip to content

Fixes Issue #7086 #7232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions 15/umbraco-commerce/how-to-guides/limit-orderline-quantity.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
description: How-To Guide to limit order line quantity in Umbraco Commerce.
description: Guide to limit order line quantity in Umbraco Commerce.
---

# Limit Order Line Quantity

In this guide, we will be looking at Validation events in Umbraco Commerce. These enabled you to limit order line quantity based on:
{% hint style="info" %}
Since Commerce 15.3.2, there is a built-in orderline quantity check that handles the validation automatically.
{% endhint %}

This guide explains custom validation event handlers in Umbraco Commerce that enable limiting order line quantities based on:

* The existing stock value of the product, and
* The existing quantity of the product in the cart.

## ProductAddValidationHandler

When adding a product to the cart we need to verify that the product is in stock. We also need to verify that the customer does not already have the remaining quantities in the cart.
When adding a product to the cart, verify that the product is in stock. Also, ensure the customer does not exceed the available quantity in the cart.

```csharp
public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOrderProductAdd>
Expand Down Expand Up @@ -41,7 +45,7 @@ public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOr

## OrderLineQuantityValidationHandler

When changing the order line quantity on the cart page, we need to ensure that the quantities being changed are in stock.
When changing the order line quantity on the cart page, ensure that the quantities being changed are in stock.

```csharp
public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<ValidateOrderLineQuantityChange>
Expand Down Expand Up @@ -69,7 +73,7 @@ public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<Val

## Register event handlers

Finally, we need to register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension.
Register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension method.

```csharp
public static class UmbracoCommerceUmbracoBuilderExtensions
Expand Down
14 changes: 9 additions & 5 deletions 16/umbraco-commerce/how-to-guides/limit-orderline-quantity.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
description: How-To Guide to limit order line quantity in Umbraco Commerce.
description: Guide to limit order line quantity in Umbraco Commerce.
---

# Limit Order Line Quantity

In this guide, we will be looking at Validation events in Umbraco Commerce. These enabled you to limit order line quantity based on:
{% hint style="info" %}
Since Commerce 15.3.2, there is a built-in orderline quantity check that handles the validation automatically.
{% endhint %}

This guide explains custom validation event handlers in Umbraco Commerce that enable limiting order line quantities based on:

* The existing stock value of the product, and
* The existing quantity of the product in the cart.

## ProductAddValidationHandler

When adding a product to the cart we need to verify that the product is in stock. We also need to verify that the customer does not already have the remaining quantities in the cart.
When adding a product to the cart, verify that the product is in stock. Also, ensure the customer does not exceed the available quantity in the cart.

```csharp
public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOrderProductAdd>
Expand Down Expand Up @@ -41,7 +45,7 @@ public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOr

## OrderLineQuantityValidationHandler

When changing the order line quantity on the cart page, we need to ensure that the quantities being changed are in stock.
When changing the order line quantity on the cart page, ensure that the quantities being changed are in stock.

```csharp
public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<ValidateOrderLineQuantityChange>
Expand Down Expand Up @@ -69,7 +73,7 @@ public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<Val

## Register event handlers

Finally, we need to register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension.
Register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension method.

```csharp
public static class UmbracoCommerceUmbracoBuilderExtensions
Expand Down