Append to Product.tags

Solved
Highlighted
New Member
2 0 0

I want to append a tag that will be used to filter products that are in stock. 

I was thinking to do this by appending an element tag labeled 'in stock' to product.tags.

Similarly, if the item is sold out, I want to remove the tag 'in stock'.

 

Is this possible? 

If its not possible then what do you think is the best way to do this other than install an app.

 

Thanks

0 Likes
Highlighted

Success.

Excursionist
651 116 329
Yes, it is possible to filter products using tag.
But it is quite inconvenient and time taking procedure to add or remove tags from products if there are much more products.

So this is an unaccepted solution.

I think you shuld use {{ product.available }} object. This object will return true if product is available and false if product is out of stock.

So you should put this object in parent div of product as a data attribute and run jquery code to filter the products.

I hope you understood.
If not ask again.
- Give likes and mark my answer as accepted solution.

Thank You
1 Like