"Can not create order, cart has no lines" error while adding a product to the cart


Description

Concurrency error might prevent a product from being added to the cart, however, the order seems to be created. The issue happens under a high load if a product is added to the cart while the same product is ordered concurrently by another shopper on a storefront website. The root cause of the issue is that the cart is cleared during order creation that leads to an error in the log similar to the following:

PipelineAbort:Can not create order, cart [number] has no lines

Solution

To resolve the issue, consider the following solution: