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.

require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));

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

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

    }
}

?>

Your Answer

 
discard

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.