How to create 2 refinementList each one with one hierarchy taxonomy level

Hello!

I have Algolia > Instantsearch in a WordPress installation, where I have a Brand custom taxonomy with 2 levels: ( Brand > Model ).

Intead of to use a hierarchical menu, I want to show this taxonomies separated using refinementList for each. To the first level (brand), this strategy works fine:

attributeName: 'taxonomies_hierarchical.brand.lvl0'

But, for the second level (model):

attributeName: 'taxonomies_hierarchical.brand.lvl1'

Screenshot_20181214_174540

Returns the string “Brand > Model” and this is not usefull. So, how can I create the second refinementList where the returned string to the template is “Model”?

Hi Jeffererson,

Take a look at the transformData or transformItems parameters that can be passed to RefinementList which allow for manipulating the items before display. You’ll likely need to use some regex to split off the model from the branch (split on the > for example).

If you are unable to make it work, create a codesandbox.io example based on one of the templates found here: https://github.com/algolia/create-instantsearch-app#previews that we can work with for troubleshooting.

Let me know how it goes and if you have further questions.
Thanks!
Jason

@jason.sooter1 thank you!

@jefferson Glad to help!