Is there a way to check if am I on Success page on Magento 2?
I know in Magento 1 we can check and compare the action name, for example. But in Magento 2, there is something similar?
Advertisement
Answer
One way would be via URL.
In your Class use this in construct:
public function __construct( // ... MagentoFrameworkUrlInterface $urlInterface, // ... ) { //... $this->_urlInterface = $urlInterface; // ... }
With $this->_urlInterface->getCurrentUrl()
you get the current url, so you can check against your checkout success url.