Shopify - using addFacetExclusion for a tag. Tag still showing in side menu

Hi,
I have excluded products by tag from the search results using addFacetExclusion, but the excluded tags are still showing in the side menu. How do I hide them from the side menu?
Thanks.

Hey there,

Can you give the code you used which gave this problem please?

Hi,

instant.search.addWidget({
  getConfiguration: function () {
    return {
      facets: ['tags']
    };
  },
  // Called only once at the load time of the page
  init: function (opts) {
    var helper = opts.helper;
    var page = helper.getPage();
    helper.addFacetExclusion('tags', 'My tag');
    helper.setPage(page);
  }
})

Products with “My tag” tag are removed from search results which is correct but “My tag” still shows in the side tags menu on the search results page.

Unfortunately, you cannot selectively hide tags using our integration.

When you use facet exclusions, you’re actually saying to the search engine that you don’t want to see any product having this tag, you’re not removing the tag from the list.

You can however do it the opposite way and specifically define which tags you want to see using a technique described here : How to exclude unwanted items from a facet (in Shopify app) .

1 Like

After re-reading the topic, I’m realizing that I went too fast, and removing products was exactly what you wanted. I’ll leave the other answer as a link to the other thread, but here your issue is different.

If it did remove the products you wanted to remove but are still seeing the tag, I believe that you’re using tags in a disjunctive way.
If you are, could you just set it up as conjunctive in our app?

Or was the disjunctive setting intended?

If the disjunctive setting was intended, then I would suggest you to try the API key solution of this topic:

With the filters baked directly into the API key, the records with this tag (and hence the tag itself) would be completely invisible to the outside world.

Hi,

It is already set up as conjunctive, but the excluded tag is still be shown in the side facet menu.

I’m sorry for the delay with my answer, I missed my discourse notifications of the past two weeks.

Could you share with us a preview link to your theme? :slight_smile: