Solved

Filter by more than one tag in tag filtering on debut

Xythia
Shopify Partner
18 2 0

So I'm driving myself crazy over here, trying to figure this out.

 

I want two filters, one to narrow down the categories and one for manufacturer. I successfully created the filters and they work independently, meaning they reset the other filter since I'm currently using link_to_tag.

I want to use link_to_add_tag instead but it only works for the first two tags before no product could possibly match that combination, because it constantly adds the tags without ever removing one. I'm trying to use link_to_remove_tag but have yet to figure it out.

 

How do I remove product tag x after selecting product tag y, without reseting vendor tag z?

 

Edit: If you need to see any of the code to fully understand me or anything else, don't hesitate to ask for it

Accepted Solution (1)

Xythia
Shopify Partner
18 2 0

This is an accepted solution.

Nevermind, I actually managed to solve it myself.

 

So if anyone is wondering it is possible with multiple codependent tag filters on debut. The answer is yes, with a bit of logic and some javascript.

 

this is only part of the solution, but it is the part that drove me crazy.

You're welcome 🙂

 

let x = this._getFilterValue2();
      let y = this._getFilterValue();
      const ySplit = y.split("/");
      const yTag = ySplit[ySplit.length -1];
      
      const xSplit = x.split("/");
      const xTag = xSplit[xSplit.length -1];
      
      
      if (yTag != "all") {
        if (xTag != "all") {
        const value = x + "+" + yTag;
        document.location.href = value.toString();
        }
        else {
        const value = y;
        document.location.href = value.toString();
        }
      }
      else
      {
        const value = x;
      document.location.href = value.toString();
      }
 
Edit: actually still working on it, discovered that this only works on collections/all.
Could use && xTag != "example collection" but that renders many tags useless

View solution in original post

Reply 1 (1)

Xythia
Shopify Partner
18 2 0

This is an accepted solution.

Nevermind, I actually managed to solve it myself.

 

So if anyone is wondering it is possible with multiple codependent tag filters on debut. The answer is yes, with a bit of logic and some javascript.

 

this is only part of the solution, but it is the part that drove me crazy.

You're welcome 🙂

 

let x = this._getFilterValue2();
      let y = this._getFilterValue();
      const ySplit = y.split("/");
      const yTag = ySplit[ySplit.length -1];
      
      const xSplit = x.split("/");
      const xTag = xSplit[xSplit.length -1];
      
      
      if (yTag != "all") {
        if (xTag != "all") {
        const value = x + "+" + yTag;
        document.location.href = value.toString();
        }
        else {
        const value = y;
        document.location.href = value.toString();
        }
      }
      else
      {
        const value = x;
      document.location.href = value.toString();
      }
 
Edit: actually still working on it, discovered that this only works on collections/all.
Could use && xTag != "example collection" but that renders many tags useless