Streaming live at 10am (PST)

How to set collection sorting by cookie setting?

Hi,
I’m building a rather complex e-commerce site with webflow and since there is no built-in filtering and sorting I’m trying to do that by custom code.
I’d like to enable users to sort by price / alphabetical etc. Ideally I want to store a cookie when they choose a sorting option and when they navigate throughout pages check in cookies which way I should sort the page collections.
Since this can be achieved with the collection list sorting option in the designer does anyone know how I could replicate this sorting on page load with some code ?
Thanks

Here’s a great tutorial on how to use MixItUp plugin with collections. It works really well.
Hope that helps.

Thanks, but that’s not exactly the idea here :slight_smile:
I’ve used mixitup in other projects, but I’d like something that can work throughout the navigation (so with cookies storing filtering choices). Therefore some other way might be just as good. And since webflow has a sorting feature in the designer I wondered if there was a way to call the collection items with some code snippet and just add some parameters (which I could change according to cookie)

Hi! I’m facing a similar problem, did you figured out a solution?

cheers.

Hi @PieterV , unfortunately no amazing answer yet… But you could just add a script in your page which in presence of the cookie, clicks on the filters you need on load (or on the sorting you need on load). Dirty… but it works.

I found out that with Finsweet “attributes CMS Filter” you can use query parameters.

So for example on one page you can put the list of categories that link to another page with the collection and add to the url of each category something like “/cms-filter?categories=category-name” and then the page will open with that filter already applied! Not perfect but does the trick I wanted!