Can you create a button in a collection if an 'available' version exists?

Hi everybody !

I have a little problem with liquid code, I hope someone can help me find the solution ! (Sorry for my english)

I duplicated a collection and removed the products already sold in the new one.

I now have two collections named in this way:
Collection1: with products in stock and products already sold
Collections1-available: with only products in stock

I would like to display a button in my collections only if the “-available” version of the current collection exists.

Would it be possible to create something like this :

If “CurentCollectionName + available” exist, show this button ?

Thank you in advance for your helps,

Best regards !!

JCA

@Juanc - have you tried checking collection handle and compare it with your required string?

@suyash1 Hi ! thank you for your reply !

I’m not very good in liquid, could you tell me how to do that?

I should use a variable “currentcollectionname” and add the string “available”, and then compare it to my existing collections.

I understand the logic but I am unable to write the code in liquid

rather than using variable and adding string we can try to check if handle
exists by comparing it with the collection name, that should work

@suyash1 could you give me the liquid code?

I don’t know how to write this condition