A very lightweight plugin to have custom cart validation rules before proceeding to checkout. For example to check current stock, or check for limited products. You can implement your own validation rules by implementing the CartValidatorStrategy interface.
Add the plugin to your config:
This will add a validateActiveOrder mutation to the shop API.
Depending on your validation strategy, you probably want to call the validateActiveOrder mutation in the cart page, and again on the payment page:
If any validation errors are returned, you can display the error to the user with the corresponding order lines. You could even automatically remove the items from the cart based on the relatedOrderLineIds.
This action is a mutation rather than a query, because your custom validation logic might need to modify the order, for example to 'lock' an order after validation until payment is completed.
You can implement your own validation rules by implementing the CartValidatorStrategy interface. For example, to check if active promotions are still valid for the items in the cart.