I'm building out a Craft 3 plugin and can't see who to pass variables with redirection from a controller.

For example, I have a controller that I want to pass back to the defined redirect value along with a variable, eg:

return $this->redirectToPostedUrl( ['order' => $order ] );

However, trying to access the order variable within my template is returning empty. The order object definitely exists before the redirection as it can be accessed from within my controller.

Any suggestions appreciated - I'm sure am overlooking something quite straightforward!

  • Is it your own route? If so you can include the parameter to your URL rules or you can store it in the Session May 1, 2018 at 16:11
  • From digging through docs and code I take it setFlash and getFlash are no longer available? The only flash method I can seem to access are notice and error related May 1, 2018 at 16:22
  • They still exists in the session component May 1, 2018 at 16:25
  • 1
    But I'd need my own variables to access this at a template level, correct? May 1, 2018 at 16:31
  • What do you mean by "my own variables"? May 1, 2018 at 16:33

1 Answer 1


Try this:

               'variables' => ['order' => $order]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.