Skip to content

Commit 9704b09

Browse files
authored
Merge pull request #7232 from umbraco/orderline-quantity
Fixes Issue #7086
2 parents 06f7e7e + 28e3c96 commit 9704b09

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

15/umbraco-commerce/how-to-guides/limit-orderline-quantity.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
---
2-
description: How-To Guide to limit order line quantity in Umbraco Commerce.
2+
description: Guide to limit order line quantity in Umbraco Commerce.
33
---
44

55
# Limit Order Line Quantity
66

7-
In this guide, we will be looking at Validation events in Umbraco Commerce. These enabled you to limit order line quantity based on:
7+
{% hint style="info" %}
8+
Since Commerce 15.3.2, there is a built-in orderline quantity check that handles the validation automatically.
9+
{% endhint %}
10+
11+
This guide explains custom validation event handlers in Umbraco Commerce that enable limiting order line quantities based on:
812

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

1216
## ProductAddValidationHandler
1317

14-
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.
18+
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.
1519

1620
```csharp
1721
public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOrderProductAdd>
@@ -41,7 +45,7 @@ public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOr
4145

4246
## OrderLineQuantityValidationHandler
4347

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

4650
```csharp
4751
public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<ValidateOrderLineQuantityChange>
@@ -69,7 +73,7 @@ public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<Val
6973

7074
## Register event handlers
7175

72-
Finally, we need to register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension.
76+
Register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension method.
7377

7478
```csharp
7579
public static class UmbracoCommerceUmbracoBuilderExtensions

16/umbraco-commerce/how-to-guides/limit-orderline-quantity.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
---
2-
description: How-To Guide to limit order line quantity in Umbraco Commerce.
2+
description: Guide to limit order line quantity in Umbraco Commerce.
33
---
44

55
# Limit Order Line Quantity
66

7-
In this guide, we will be looking at Validation events in Umbraco Commerce. These enabled you to limit order line quantity based on:
7+
{% hint style="info" %}
8+
Since Commerce 15.3.2, there is a built-in orderline quantity check that handles the validation automatically.
9+
{% endhint %}
10+
11+
This guide explains custom validation event handlers in Umbraco Commerce that enable limiting order line quantities based on:
812

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

1216
## ProductAddValidationHandler
1317

14-
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.
18+
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.
1519

1620
```csharp
1721
public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOrderProductAdd>
@@ -41,7 +45,7 @@ public class ProductAddValidationHandler : ValidationEventHandlerBase<ValidateOr
4145

4246
## OrderLineQuantityValidationHandler
4347

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

4650
```csharp
4751
public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<ValidateOrderLineQuantityChange>
@@ -69,7 +73,7 @@ public class OrderLineQuantityValidationHandler : ValidationEventHandlerBase<Val
6973

7074
## Register event handlers
7175

72-
Finally, we need to register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension.
76+
Register the Umbraco Commerce event handlers via an `IUmbracoCommerceBuilder` extension method.
7377

7478
```csharp
7579
public static class UmbracoCommerceUmbracoBuilderExtensions

0 commit comments

Comments
 (0)