Add to cart button - Collections page - Prestige Theme

Hi there!

I’m using the Prestige theme, and I have added some code to add a ‘add to cart’ button on the collections page. It works great, but now I need to hide it for products sold out or unavailable.

Unfortunately, the button keeps showing up, so I am manually hiding those products at the moment, which is not ideal.

I would appreciate your help so much!

Thanks!

Hello @GTStudio ,
Please share your website URL.
and also share you product-grid.liquid file code.

@MandasaTech The website URL is: https://sunshineliving.dk/
But I can’t find the product-grid.liquid file code. Is there anything else I can provide you with?

https://sunshineliving.dk/password - please share your store password.

@MandasaTech it’s blaske. Thank you!

Hi @GTStudio ,

You can hide the add to cart button by using a liquid condition, we need access to the code to provide a solution.

@SmallTask This is the code I pasted in product-item.liquid


{{ ‘product.form.add_to_cart’ | t }}

Thanks so much. Let me know if you need anything else.

@SmallTask @MandasaTech , any updates on this, please?

I would be so grateful if you could help! :folded_hands:

@GTStudio

Replace your code with below code.

{% if product.available %}

{{ ‘product.form.add_to_cart’ | t }}

{% endif %}

Thanks so much @MandasaTech !

This worked! You’re a star :star:

Hi, I was hoping you could help us too.

I pasted this code on our prestige theme. It shows the button on the collection pages, but when I click the “add to cart button”, it just open the cart drawer and not put the products in. Also, how can we add a choice for variants here? We have some products that have variants, is it possible for the customer to select the variants on the quick add?

Our URL is https://www.usandtheearth.com/collections/all

Hi @GTStudio , resolve the issue of missing “Add to Cart” buttons on Shopify collection pages by watching this helpful YouTube tutorial: https://www.youtube.com/watch?v=s98l1bUZe6k