Hide add to cart button unless logged in - Dawn Theme

Hide add to cart button unless logged in - Dawn Theme

GoDarkBags
Tourist
10 0 1

In a nutshell, I have an add to quote and add to cart button placed on my product pages at the moment. I would like only the add to quote button to display to users that are logged out, and only the Add to cart button to display when they are logged in. How would I go about doing this?

Replies 3 (3)

ThePixelEdge
Shopify Partner
164 16 17

Hello @GoDarkBags 
Here is the code Please follow the suggested steps in the screenshot.
Dawn Hide Add to cart if cutomer not logged in .png

If helpful then please Like and Accept Solution .
Buy me A Coffee

Whatsapp :- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications


Connect with Us in Our DMs | teampixeledge@gmail.com
GoDarkBags
Tourist
10 0 1

Thank you for this! unfortunately I am not well-versed in coding, and, as we have some third party apps installed, the code does not look identical to what you are showing, so I wouldn't know how to do this properly without potentially breaking the site 

nikkyb
Tourist
5 0 0

Thank you.  I was having touble finding the page to make this edit (I knew the code to change but not where to put it) and so this explanation was perfect.

 

As an additional side note, I have added in a requirement that customer accounts are tagged as 'wholesale' (my situation) in order to see the buy button / add to cart buttons. This gives me an additional layer of oversight & control as to who can check out.

 

The extra code is: {% if customer and customer.tags contains 'wholesale' %}