0

Magento has a feature to redirect to the referrer page after a customer logs in.

I have done this using the following code:

$referer_url = $this->_redirect->getRefererUrl();

$CustomRedirectionUrl = $url->getUrl('customer/account/login',
    array('referer' => base64_encode($referer_url)));

But this referrer URL is not working with Facebook/Google signup; it is redirecting to the My Account page.

1

Try to use this code :

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$objecturl = $objectManager->create('Magento\Framework\Url\Helper\Data');

echo $this->getUrl('customer/account/login', array('referer' => $objecturl->getEncodedUrl($this->getUrl('action where you want to redirect'))))

Note : Do not use direct ObjectManager.

| improve this answer | |
  • Dont provide solutions and state afterwards that one shouldn't do it. – Max Aug 16 '18 at 10:30

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.