How to pass a list of parameters as URL query parameters

I want to redirect my users to another page and send a list of parameters using URL query parameters. Below an example of the list I would like to send:

foo = ["asd", "qwe"]

This is what I have tried so far but isn’t working:

wixLocation.to("/stores/products?foo=asd&foo=qwe");

When I try this, the query parameters get overridden and only one parameter is sent instead. This is the link that my user gets redirected to: “/stores/products?foo=asd”.

So, my question is, how can I pass a list of parameters using query parameters?

I just found out that it suffices to use “,” as a separator when creating the query parameter string. So, the following fixes my issue:

wixLocation.to("/stores/products?foo=asd,qwe");

What is even cooler is that on the receiving side the query is already given in a list format. Great!