I'd like to implement a feature that makes an external API call then depending on whether the request is fulfilled the product line-item gets added to the cart else it shows a translated flash message to the customer that the product couldn't be added to the cart for X reason/s.
What I have tried is subscribing to the BeforeLineItemAddedEvent but it seems that the line item is already added to the cart by this point and I'm not quite sure how to implement the flash message thing.