How can I delete customers who never logged in? I can't find any solution. I think I have over 40000 customers who never logged in, so I can't delete them by hand.

If you have already set the option System > Configuration > Advanced > System > Log > Enable Log to YES then you can check log_customer table and get customer_id who logged into system before. After that you can write a script to delete customer whose id is not matching with these ID.

Add script in your root folder and run it.


$collection = mage::getModel('customer/customer')->getCollection();

foreach ($collection as $customer){
    $log = Mage::getModel('log/visitor_online')->getCollection()->addFieldToFilter('customer_id', $customer->getId())->getFirstItem();
        echo 'Customer with email '.$customer->getEmail().' is deleted </br>';



Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.