In my case. i visited to checkout page and logined. How to check current page is checkout and redirect back to it! Tried
if($this->session->getCurrentPage() == 'checkout') {
return $store->getUrl('checkout');
}
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTry this
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$urlInterface=$objectManager->create('Magento\Framework\UrlInterface');
echo $urlInterface->getCurrentUrl();
Set block content with custom function :
protected $_request;
public function __construct(
...
\Magento\Framework\App\Request\Http $request,
...
) {
...
$this->_request = $request;
...
}
public function isHomepage()
{
if ($this->_request->getFullActionName() == 'cms_index_index') {//cms_index_index your page identifier e.g. 'checkout_index_index' for checkout
return true;
}
return false;
}
Template code :
<?php $isHome = $block->isHomepage(); ?>