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?
Topic summary
-
Goal: Show only âAdd to quoteâ to logged-out visitors and only âAdd to cartâ to logged-in customers on product pages.
-
Proposed solution: Use Shopify Liquid conditionals around the buttons to toggle visibility based on login state (the âcustomerâ object). A reply included code and a step-by-step screenshot showing where to edit in the Dawn theme; that screenshot is central to implementation.
-
Constraint: The requesterâs theme includes third-party app customizations, so their code structure differs and theyâre cautious about making changes that could break the site.
-
Variant enhancement: Another user added a requirement that only customers tagged âwholesaleâ see the buy/add-to-cart buttons, using: {% if customer and customer.tags contains âwholesaleâ %}. This provides tighter control over who can check out.
-
Terms: Liquid is Shopifyâs templating language; the âcustomerâ object exists only when a user is logged in; customer tags are labels assigned to accounts.
-
Status: No confirmed implementation by the original requester; guidance helped others, but the requester likely needs customization-aware edits. Discussion remains open.
Hello @GoDarkBags
Here is the code Please follow the suggested steps in the screenshot.
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
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â %}
