Cart Validation

Note: Spartacus 4.x is no longer maintained. Please upgrade to the latest version.

Note: Spartacus 4.x was tested with SAP Commerce Cloud versions 1905 to 2205. Spartacus 4.x has not been verified to work with (and is not guaranteed to work with) SAP Commerce Cloud 2211 or later releases.

Note: This feature is introduced with version 4.2 of the Spartacus libraries.

The cart validation feature allows Spartacus to verify a user’s cart at every step during checkout to ensure that the requested quantity of each item is available. If the quantity of an item is reduced, or an item is out of stock and no longer available, the user is redirected to the cart page, and Spartacus displays a global message about the change to the user’s cart.


The cart validation feature requires SAP Commerce Cloud 2011 or newer.

Enabling Cart Validation

To enable cart validation, set the enabled flag to true in the cart validation configuration. The following is an example:

cart: {
  validation: {
    enabled: true


Cart validation is enabled for every step in the checkout process. You can turn off validation for any individual step by removing the CartValidationGuard class from the CMS component configuration in the relevant checkout module.


No special extensibility is available for this feature.