Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Need to replace add to cart with POA linking to contact page and hide prices on specific collection

Need to replace add to cart with POA linking to contact page and hide prices on specific collection

wearegoatmedia
Visitor
2 0 1

Hello, wondering if someone could please assist me in making some adjustments to my clients store - she would like to have products in one specific collection not show price or add to cart and instead replace add to cart with POA (or CONTACT FOR PRICE) which links to her contact page.

Replies 2 (2)

Liam
Community Manager
3108 344 889

Hi Wearegoatmedia,

 

There's a few ways you could achieve this for your client, depending on how your theme is structured, but you likely be using Liquids conditional tags. For products that shouldn't display an add to cart button or price, you can assign a tag to the product on the admin (eg: "special"). Then you'd set up logic on the theme so that when the tag is present the add to cart button or price won't appear. For the add to cart button, you'd need to find where this is being included, eg on Dawn it's in the buy-buttons.liquid snippet here, and add logic like:

 

 

{% if product.tags contains 'special' %}
  <p><a href="url">Contact for price</a></p>
{% else %}
  {%- form 'product',

 

On the product page this will look like:

 Then for the price you can find where it's being included in the product section, (eg here on Dawn), and adjust the logic again with something like:

 

{%- when 'price' -%}
  {% unless product.tags contains 'special' %}
    <div class="no-js-hidden" id="price-{{ section.id }}" role="status" {{ block.shopify_attributes }}>

 

Then your product will look like:

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ShishirHelps
Shopify Partner
70 3 4

Hi Lam

This is helpful.

Thanks

- I'm Shishir Hasan a Shopify Store Developer | CRO specialist.
- Need a Shopify developer?

Chat on WhatsApp || Work with Upwork


- If this solves the problem, please don't forget to Mark it as Solution!