Is there any script available for migrate woocommerce customer password to magento2 customer password.

  • Password encryption algorithm are different in woocommerece and Magento 2. so you need to considered while migration. – Pramod Kharade Feb 6 '18 at 12:56
  • I know its different thats why I am asking for script – Yogesh Karodiya Feb 6 '18 at 13:05
  • May be this could help shopping-cart-migration.com/cart2cart-plugin/… – Amit Singh Feb 6 '18 at 14:16
  • I would recommend to not actually migrate the password but sent a password forgotten email to the customer. This is also for security reasons – Mr. Lewis Feb 6 '18 at 21:35

my method: if i know hash metod in "old system",
1. store "old system" hash in customer table [for sample new column in table]
2. get user login data compare with "old system" hash
3. if hash is ok then change password in magento basing on post data and mark as "changed"
User can use their old password and we dont need send reset password emails for customers.

create plugin in magento in di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Customer\Controller\Account\LoginPost">
    <plugin name="nameofplugin"

and in Vendor\MyModule\Plugin\Customer\LoginPost.php

    namespace Vendor\MyModule\Plugin\Customer;
    use \Magento\Framework\Encryption\EncryptorInterface;

    class LoginPost
            protected $request;
            protected $encryptor;
            protected $_customerRegistry;

        protected $_CustomerRepositoryInterface;

             public function __construct(
            \Magento\Framework\App\Request\Http $request,
            \Magento\Framework\Encryption\EncryptorInterface $encryptor,
            \Magento\Customer\Model\CustomerRegistry $customerRegistry,
            \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
        ) {
            $this->request = $request;
                    $this->encryptor = $encryptor;
                    $this->_customerRegistry   = $customerRegistry;
            $this->_CustomerRepositoryInterface = $customerRepository;


        public function aroundExecute(\Magento\Customer\Controller\Account\LoginPost $subject, \Closure $proceed)
            // your custom code before the original execute function
            $this->CheckIsUserExistsAndHashOldPass($subject,$proceed );
            // call the original execute function
            $returnValue = $proceed();
            return $returnValue;

     public function CheckIsUserExistsAndHashOldPass(\Magento\Customer\Controller\Account\LoginPost $subject,\Closure $proceed){
// check: if need reset password  
    $data = $this->request->getPost();
    // check user with old hash if ok change magento password for this user


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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