Try our conversational search powered by Generative AI!

Commerce prevents item with untracked inventory from being added to order if "Max. quantity" not high enough

Found in

EPiServer.Commerce 10.4.1

Fixed in

EPiServer.Commerce 10.5.0

(Or a related package)

Created

Mar 13, 2017

Updated

Apr 14, 2017

Area

Core

State

Closed, Fixed and tested


Description

Cart validation behaves differently depending on whether it is done with old format workflow validation or new format ICart extensions-based validation.
This bug occurs if variation is set to have a Max. quantity but is not tracked by inventory.

The problem is that, in the same situation and depending only on which validation method is used, the max. quantity limit is either ignored or changes the line item quantity.
In other words, front-end validation allows quantities over max. quantity value, while Commerce Manager changes overly large quantities to follow the limit. The error is in the front-end validation, which should limit the quantity and set corresponding AdjustedQuantityByMaxQuantity.

Steps to reproduce:
1. Create/update a variation with a Max. quantity of 100 and Tracked set as unchecked.
2. Run the test code:

var test1 = new MaxQuantityTester().Test(code, 50);
var test2 = new MaxQuantityTester().Test(code, 150);

3. Notice that test1 == true and test2 == false, indicating that validations give conflicting results when Max. quantity is reached.