The deletion of old shopping carts can be done automatically with the pre-defined task.
By default, all the shopping carts older than 30 days are considered old and therefore are erased when running the Deleting old shopping carts task. You can change the period of time after which the shopping cart expires by modifying the CMSShoppingCartExpirationPeriod key in the web.config file. See the Web.config settings chapter for more details.
This task erases not only old shopping carts, but anonymous customers with no order as well. This anonymous customer with no order appears when an anonymous user adds an item into the shopping cart. They are then required to enter their name and e-mail and they become a customer. If this anonymous user, for whatever reason, doesn't get through all steps of the checkout process, they remain in the system as anonymous customers with no order.
You can schedule the deletion of old shopping carts task by setting the Scheduler at CMS Site Manager -> Administration -> Scheduled tasks.
For more information please refer to the Scheduler chapter in Kentico CMS Developer's guide.