Filtering List by ZIP Code Prefix using Attributes – Possible without custom JS?

Hey everyone :waving_hand:

I’m currently working on a section where users can search for the right contact person based on their postal code (ZIP code). I’m using Finsweet Attributes List Filter, and I’d love to get some input on whether the following setup is possible with the standard Attributes setup — or if I’d need to add custom JavaScript.

Here’s the idea:

  • Each contact person is assigned to one or more postal code regions, defined by the first two digits of the ZIP code (e.g., 04, 22, etc.).
  • Users should enter their full ZIP code into an input field (e.g., 04277).
  • However, I only want to use the first two digits of the input to filter the list.

My questions:

  1. Is there a way to dynamically extract only the first two digits from the user input before filtering with Attributes?
  2. Or would I need to write some custom JavaScript to trim the input value before it’s passed to the filter?
  3. And if custom JS is needed, can it be combined safely with Attributes without breaking functionality?

Would love to hear your thoughts or see if anyone has done something similar!

Thanks in advance :folded_hands:

Hey @juicydisorder! For Attributes V2, we have included a new Fuzzy Search setting, which could be useful in this setting.

However, if you want to go the custom code route, the safest way to add code is with the Attributes API, which is detailed here:

If you need any help with the code, don’t hesitate to reach out!