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.

2

1 Answer 1

0

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.

1
  • 3
    Dont provide solutions and state afterwards that one shouldn't do it.
    – Max
    Aug 16, 2018 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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