Jump to content
  • 0

[Developer Question] Is it possible to adjust the 'current_tags' object using javascript?



I am working for a client that uses a tag for the different manufacturers of their products. Each product will only have one manufacturer tag. On their collections page, they have a sidebar that shows all the Manufacturer names with a {{ tag | link_to_add_tag: tag }} URL. Now the problem is when users are selecting more than one manufacturer tag, it will return no results since its searching for products that have both manufacturer tags.So, what we need is either:

A) A way to filter the products with tags using OR logic rather than AND. So a user can select multiple manufacturer tags and have it still show results of products that have any of the tags passed.

B) I found some documentation on the'current_tags' object. What I would want to do is:

  1. User clicks a manufacturer tag

  2. Check if any manufacturer tag is in current_tags

  3. If any manufacturer tag is, remove it

  4. Add the manufacturer tag that user clicked in Step 1

This would mean users would have their first manufacturer tag forcibly removed, thus not allowing them to stack the tags.

Does any of this make sense?
Is there an easier way to do this?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...