The routes.storefront_login_url redirect contains an incorrectly processed country query parameter, which will break another query parameter on redirect. When you are redirected after logging in, the country parameter is encoded, so instead of it being treated like a separate query parameter, it is appended to the value of the previous parameter. For example, if I have the query param brand=x the redirect will turn the full link into ?brand=x%3Fcountry%3DNO
Reproduction steps
Go to a URL on your store with a query param, such as: /collections/accessories?filter.p.m.custom.availability_filter=Available
Log in using the routes.storefront_login_url
See that the url upon redirect is now /collections/accessories?company_location_changed=true&filter.p.m.custom.weight=1%20kg%3Fcountry%3DNO. %3Fcountry%3DNO is problematic, as it is now being read as part of the value for the filter.p.m.custom.weight query parameter.
Additional info
This particular store also has a company linked to the customer, though from what we can tell this shouldn’t be an issue.
In the last step before being redirected from the account page (in this store that is the company selection), the return_to url doesn’t contain the country parameter at all.
I did some digging on our end and this might be related to something we’re tracking on our end.
A couple things that would help me narrow this down:
Could you share the shop URL where you’re seeing this (let me know if you’d rather work on this over DM and I can set this up)?
Is this happening consistently, or intermittently?
You mentioned the store has a company linked to the customer. Is this a B2B store using company accounts or the B2B Customer API? Just want to confirm since the redirect path through company selection could be relevant here.
If possible I would like to handle this over DM, as for the other questions:
This happens consistently. So far I have had it happen every single time, I’ve checked on different stores and it also seems to happen on stores where there are no companies involved, so it doesn’t seem to be because of any B2B settings.
How can I send you a DM with information on the store(s)?
Hey @Tristan_Kirwan - no worries and thanks for confirming. For Shopify staff, right now on the forums we have to be the ones to initiate DMs, but I’ll set one up and follow up with you there right away.
If you have access to your network logs, check if you’re getting an infinite 302 error during login.
I’ve seen Shopify redirects break due to a conflict between new B2B customer accounts and certain theme scripts that force a redirect URL (return_to).
If this is happening on multiple stores, it’s clearly a Shopify API bug, but checking if a redirect parameter is being mistakenly injected into the URL might help while you wait for the staff to fix it.