Hi, when switching language with active filter, the filter value in the url dosen’t translate resulting in “no products found”.
Im using Search & Discovery for translation for the filter values that are product metafields, single line texts.
Example: ?filter.p.m.custom.material=cotton , and when changing to language to French I want it to change to ?filter.p.m.custom.material=coton (the rest of the URL changes correctly), but it stays as ?filter.p.m.custom.material=cotton with then obviously no results.
What is the correct sollution for this? I know I can add a workaround like clearing all filters when switching, but since there already is a translation, guessing there must be a recommended way of solving this?
Same problem in both Horizon, Prestige & Broadcast so guessing not a template issue.
This is not a theme thing, which lines up with you seeing it in Horizon, Prestige and Broadcast. The filter value in the URL is matched literally against the metafield value in the locale you are currently on. In French the value is coton, the URL still says cotton, so nothing matches. The language switcher just carries the query string across in return_to, it does not remap the values, and there is no setting that makes it.
The way out is to stop filtering on a single line text value and filter on a metaobject reference instead. Make a metaobject definition for material with one entry per material, point the product metafield at it, and rebuild the filter on that. The URL then carries the metaobject id rather than the word, so it looks like filter.p.m.custom.material=gid://shopify/Metaobject/83108692262. That id is identical in every language, so switching locale keeps the filter alive, and the visible label still swaps because you turn on the translatable capability on the metaobject definition and translate the name field in Translate and Adapt.
Two things to know before you commit to it. Shopify documents metaobject filters as visual filters, so the definition needs a color field or an image field alongside the name field, meaning you end up adding a swatch per material whether you display it or not. And the URLs get long and unreadable. There is a thread on the dev forum called Non-readable URL if filtered with metafield with metaobject reference where people are asking for handles instead of ids, so that part is not going to improve soon.
One more thing worth ruling out first. If any of your languages is a market specific instance of a language rather than a plain store language, filter value translations do not apply to those at all. Labels and groups do, values do not, so the value would stay in the default language and behave exactly like what you are seeing. Are your languages set up per market or as plain store languages?
This isn’t your theme — that’s why it reproduces in Horizon, Prestige and Broadcast alike. The value in filter.p.m.custom.material=cotton is the metafield value as indexed for the active language, not a language-independent key. Under /fr the indexed value is coton, so the English value matches nothing. Switching language only swaps the locale prefix; nothing re-maps filter values between languages, and themes get no such map to work with.
So dropping the filters on switch is the supported answer, not a hack. The lever is the return_to input that the localization form renders — it takes a relative path, so point it at the current path without the query string (request.path) instead of the full URL your theme passes now. Verify it on a filtered collection page: after switching you should land on the same collection in French with no filter.* params, rather than on an empty result set.