Magento 1 :

The code for delete shopping cart items for logged in customer:

The code for delete shopping cart items for all customers:

If you have a large number of customers quotes then deleting them by using loop might be time and resource consuming. You can clear/delete all customers cart items (all active sales quotes) by using the following SQL query:

is_active = 0 means those quotes have been converted into orders, i.e. customer has placed order for those quotes.
is_active = 1 means quotes that have not been ordered, i.e. quotes present in the shopping cart of customers

Running this query will automatically delete related rows (quote items) from sales_flat_quote_item table through foreign key constraint.

Magento 2 :

To delete items from cart you need to follow these functions:

Thank for reading this post, Hope it helps.

Leave A Comment?

You must be logged in to post a comment.