Hello. How can I run some code when leaving a specific page? I tried this hook:
'route:after' => function($route, $path, $method, $result, $final) {
if ($path !== 'checkout') {
removeAllShipping();
}
}
to run this code after leaving the checkout
page, and it works, but is there a better way? The above will needlessly be executed for every page change.