Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 37508

Event/observer is used to work dynamically with Magento without altering the core code.

15 votes
Accepted

magento 2 run function on every page

Per Robbie's suggestion I created: etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ev …
Xenocide8998's user avatar
  • 1,782
8 votes
1 answer
7k views

magento 2 run function on every page

I have a function that retrieves a visiting user's country name by doing an ip lookup. I currently have this function running through the execute method in my module's controller. The problem is tha …
Xenocide8998's user avatar
  • 1,782
0 votes

Magento2: Re-direct to custom URL from observer

Here is what I did (remember to set the action flag): /** * @var \Magento\Framework\App\Response\RedirectInterface */ protected $redirect; /** * @var \Magento\Framework\App\ActionFlag */ protect …
Xenocide8998's user avatar
  • 1,782