cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 authentication login popup auto open!!!

Magento 2 authentication login popup auto open!!!

I am using Magento 2.2.4. If user opens the product page, I just want to open authentication popup automatically. I am adding script on addtocart.phtml file

 

require([
    'jquery',
    'Magento_Customer/js/model/authentication-popup'
], function ($,auth) {
    if($.isEmptyObject(window.info)){
            //code here
    }
    return false;
});

I just need to know what i should do in isEmptyObject condition so that popup opens automatically.

1 REPLY 1

Re: Magento 2 authentication login popup auto open!!!

Hello,

 

require([
    'jquery',
    'Magento_Customer/js/model/authentication-popup'
], function ($,auth) {
   auth.showModal();
   // if you want to check customer is not login then open
 // if(auth.isActive())
 //{
//  auth.showModal();
// }
});

if works then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer