Skip to content

Issue with loading checkout/cart when the product has “out of stock” status

scenario in magento 2.4.6:

When an item in cart goes out of stock, that cart can no longer be reloaded without an error that leads to infinite loading afterwards.

The goal, I guess, is to remove the item from the cart before the page renders.

I tried some observers I found online, specifically the sales_quote_save_before event, but it had no effect.

I would appreciate some suggestions and code samples.