I want to check if a user is logged in before proceeding to checkout. On the basis of customer login condition, i want to show the login popup if not login, and redirect to checkout if logged in already.
IMPORTANT: I have guest checkout enabled in the configuration. Because I want user to checkout with guest account
I am able to redirect user to login page when not logged in. But not able to use popup instead of redirecting it to login page.
to redirect user to login page, I did the following changes in my minicart.js file:
var cc = customerData.get('customer');
if(cc().firstname){
console.log("customerData",true);
var urls = window.checkout.checkoutUrl;
}else{
console.log("customerData",false);
$( document.body ).removeClass( "logedin" );
var urls = window.checkout.customerLoginUrl;
}
please help me find out how to use popup login instead redirecting to login page.