Programatically clear the cart of a logged-in user
Check quote status is_active for the quote (sales_flat_quote) regarding to the created order. If its active (value is 1) set it inactive ($quote->setIsActive(0)->save()
) after successfully order creation and than clear checkout session.
This is against standard Magento logic, so you need a custom module that will observe customer_logout event and execute the following code bit:
foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
}
more info
/** @var Mage_Sales_Model_Quote $quote */
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->removeAllItems()->save();