Hi we are thinking to do the below on product page;
Show “add to cart” button when a customer is logged in only.
Hide “add to cart” button then show another a button that leads to “log in” or “create an account” page instead.
Is it possible? If so we would like to know which code we have to edit.
Hello @Sachiyo ,
You have to make the ‘atc’ button conditional.
Check the example:
{% if customer %}
Your exisitng code of 'add to cart' button
{% else %}
Add button for login
{% endif %}
Thanks
1 Like
Thank you for your example, much appreciated.
If possible may I know which file I can edit for the ‘atc’ button conditional?
It all depends on what theme you are using.
Mostly its template i under Templates → product.liquid and further code is under Section → product.liquid
If you are 2.0 then Json file is available under Templates and further code file will available under Sections and snippets.
@Guleria
Hey there! I am trying to use this code in order to hide the add to cart button on the collection pages. I am using Dawn, and I haven’t seen much information on how to fix this using this theme. I have successfully hidden the add to cart button using the conditional in the product page, but can’t seem to find the right place to change the code in order to do the same thing on the collection page. Do you happen to know where this would be? Thanks so much!
Hi Sean,
Yasaman’s here from Subify.
If you want to apply this on your collection pages, then you have to do the same in Snippet->product-grid.liquid or Snippet->product-cart.liquid, depending on your theme. Hope this will be helpful.