You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had few cases were I couldn't use storefrontRedirect so I had to do my own implementation (by copy-pasting storefrontRedirect code and modify it).
The main thing is that it doesn't handle route params, e.g locale.
For example, there is a redirect configured in Shopify like following:
From: /myUrlFrom, To: /myUrlTo
The storefront redirect will not handle theses:
/fr/myUrlFrom/ -> doesn't match any redirect url
So we should have a parameter or something to deal with locale.
In my own implementation I added 2 paramaters:
/* locale (e.g: fr-fr) to prefix redirect url, if the redirect url is absolute then we don't prefix it /
localePrefix?: string;
/ Full string url. e.g: https://example.com/search?query=param, it will be used to match the redirect url */
matchingUrl: string;
Since we are not tied anymore to the request parameter we can pass everything we want. Also if we want to prefix the redirect url we can.
Context #2562 (comment)
The text was updated successfully, but these errors were encountered: