SOLVED: Nested term queries are displayed as duplicates

Browser: Chrome 110
OS: Windows
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

Hello bricks team,

I tried to display nested product categories using a query loop, but there seems to be a problem. As you can see in the screenshot below, the Dresses category is a subcategory of Girls within the Kids category. But in the query loop, the Dresses category is displayed twice, one in the Girls subcategory and one in the Kids subcategory.

{"content":[{"id":"sxkduo","name":"section","parent":0,"children":["yusoyk"],"settings":{}},{"id":"yusoyk","name":"container","parent":"sxkduo","children":["njxufg"],"settings":{"_padding":{"top":"10","right":"10","bottom":"10","left":"10"}}},{"id":"njxufg","name":"block","parent":"yusoyk","children":["uhcvjk"],"settings":{},"label":"Product category"},{"id":"uhcvjk","name":"div","parent":"njxufg","children":["kwmwxy","okmpqh"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"tax_query_not":["product_cat::15"],"show_empty":true,"parent":"0"}},"label":"Parent terms"},{"id":"kwmwxy","name":"text-basic","parent":"uhcvjk","children":[],"settings":{"tag":"span","text":"{term_name}"}},{"id":"okmpqh","name":"div","parent":"uhcvjk","children":["haeywg","piqkug"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"tax_query_not":["product_cat::15"],"show_empty":true,"child_of":"{term_id}"},"_margin":{"left":"15"}},"label":"Parent terms"},{"id":"haeywg","name":"text-basic","parent":"okmpqh","children":[],"settings":{"tag":"span","text":"{term_name}"}},{"id":"piqkug","name":"div","parent":"okmpqh","children":["jtgcxi"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"tax_query_not":["product_cat::15"],"show_empty":true,"child_of":"{term_id}"},"_margin":{"left":"15"}},"label":"Parent terms"},{"id":"jtgcxi","name":"text-basic","parent":"piqkug","children":[],"settings":{"tag":"span","text":"{term_name}"}}],"source":"bricksCopiedElements","sourceUrl":"https://try.bricksbuilder.io/t699ffa6","version":"2.0.2","globalClasses":[],"globalElements":[]}


Best regards

Hi @Fred.foden,

Is the same happening if you use {term_id} on your Parent control, on both nested query loops?
CleanShot 2025-09-08 at 14.52.46@2x

Matej

1 Like

Hi @Matej,

Thank you very much for providing this great solution. It works fine now😍

But in the builder it seems there is still a problem. The third sub-set (Dresses) is still displayed twice in builder. While in the frontend everything is fine.

Builder

Builder

Frontend

Frontend

Just one more question, please help if possible.

If we want to display only terms that do not have children, we enable the Childless option. But if we want to display only terms that have children, is there a solution?

Thanks in advance for any advice.

Perfect, I’m glad that it works fine, at least on frontend.

Have you changed the control in both query loops? I can’t replicate the issue locally, that’s why I’m asking.

For the first one, yes. But for the second one, you will have to write a custom query or use filters to change the query vars.

Best regards,
Matej

Hi @Matej,

Have you changed the control in both query loops? I can’t replicate the issue locally, that’s why I’m asking.

Yes, I changed both queries and they have the same settings. I think it makes sense that there is a duplicate. Because according to the previous screenshot, Accessories does not have a subcategory. That’s why bricks auto-populates the value so that there is something to edit in the builder, right?

For the first one, yes. But for the second one, you will have to write a custom query or use filters to change the query vars.

Thanks. Is it possible to add it natively to bricks? If it is possible at all, can I add a feature request for it?

Can you post a screenshot where I can see all categories - please make a full screenshot, including the number of items in the right. If it’s empty, I would expect that it shows dynamic tag, not some random category.

Yeah, it’s best if you can add an idea board entry. :v:

Matej

1 Like

Hi @Matej,

Sure,

Category structure

Builder

Frontend

Frontend

Code

{"content":[{"id":"sxkduo","name":"section","parent":0,"children":["yusoyk"],"settings":[]},{"id":"yusoyk","name":"container","parent":"sxkduo","children":["njxufg"],"settings":{"_padding":{"top":"10","right":"10","bottom":"10","left":"10"}}},{"id":"njxufg","name":"block","parent":"yusoyk","children":["uhcvjk"],"settings":{"tag":"ul"},"label":"Product category"},{"id":"uhcvjk","name":"div","parent":"njxufg","children":["kwmwxy","okmpqh"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"tax_query_not":["product_cat::15"],"show_empty":true,"parent":"0"},"tag":"li"},"label":"Parent terms"},{"id":"kwmwxy","name":"text-basic","parent":"uhcvjk","children":[],"settings":{"tag":"span","text":"{term_name}","link":{"type":"external","url":"{term_url}"}}},{"id":"okmpqh","name":"div","parent":"uhcvjk","children":["haeywg","abconi"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"show_empty":true,"parent":"{term_id}"},"_margin":{"left":"15"},"tag":"li"},"label":"Parent terms"},{"id":"haeywg","name":"text-basic","parent":"okmpqh","children":[],"settings":{"tag":"span","text":"{term_name}","link":{"type":"external","url":"{term_url}"}}},{"id":"abconi","name":"div","parent":"okmpqh","children":["qprzfu"],"settings":{"hasLoop":true,"query":{"objectType":"term","taxonomy":["product_cat"],"show_empty":true,"parent":"{term_id}"},"_margin":{"left":"30"},"tag":"li"},"label":"Parent terms"},{"id":"qprzfu","name":"text-basic","parent":"abconi","children":[],"settings":{"tag":"span","text":"{term_name}","link":{"type":"external","url":"{term_url}"}}}],"source":"bricksCopiedElements","sourceUrl":"https://try.bricksbuilder.io/t699ffa6","version":"2.0.2","globalClasses":[],"globalElements":[]}

If I forgot anything please let me know.

HI @Fred.foden,

yeah, there is one crucial thing missing, that I wanted to see, and that is the “count” row on the right - basically, screenshot of the whole table.

Matej

I’m so sorry @Matej,

Hi @Fred.foden,

perfect, thank you! I was able to replicate it now, and I’ve logged it to our internal bug tracker.

Thanks for all the help and patience with me here. :slight_smile:
Matej

Hi @Matej,

Great that you were successful in reproducing.

I also added an idea to the idea board to show categories that have child. I would be happy if you could approve it so that it can be voted on.

Cheers

The approval of idea board entries is handled by Thomas, but I suppose he will enable it.

Matej

1 Like

We fixed this issue in Bricks 2.2 RC, now available as a manual download in your account (see changelog).

Please let us know if you are still experiencing issues.

As with any pre-stable release, please do not use it on a production website. It is intended for testing in a local or staging environment only.