The following code returns the current URL in a Magento 2 template (phtml):
|
1 |
$currentUrl = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]); |
Getting the current URL in a template
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.