Home » Magento9 September 2014

Magento: Clear / Delete Shopping Cart Items of Single or All Customers

Here is the code to delete all shopping cart items of currently logged in single customer:

If you want to clear all shopping cart items of all customers then you can use the following code:

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.

Hope it helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Julie

    I will prefer using your first method and will not recommend the second method. You are actually aware of that there is more than one table that get affected using the first method right and the second method clears just one of these tables! at the end your database will have unnecessary records.