I want to add query parameter to my current url, I'm getting current url in my phtml like this:

$current_url = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);

I want to add query parameter to my url so it will look like this:


And when the current url already has another query parameter, it will look like this:



Try this

$current_url = $this->getUrl('*/*/*', array('_current' => true,'_use_rewrite' => true, '_query' => $your_query));


 $your_query = array('new_query' => 123)
| improve this answer | |
  • what is inside $your_query ? – Shell Suite Nov 16 '17 at 8:54
  • 1
    It's works for me – Vaibhav Ahalpara Nov 16 '17 at 8:59
  • Which file need to edit to add query param? – Shoaib Saleem Oct 4 '19 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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