I am trying to redirect the customer when their store view is not correct. When I redirect the _request method it is GET and I need it to be POST

  if ($currentStore !== $customerStore) {
       $params = $this->getRequest()->getParams();
       $url = $this->_url->setScope($customerStore)->getUrl('customer/account/loginPost', $this->getRequest()->getParams());
       $resultRedirect = $this->resultRedirectFactory->create();
       return $resultRedirect;

You can directly use like this.


It will redirect there.

Hope it will help you.


Does something like this work


$param = ['param1' => 'value1', 'param2' => 'value2'];
    $resultRedirect->setPath('frontname/path/controllername', ['params' => $params]);

Failing that you could look into a curl request. With curl you can post to a url with params.

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.