Focusing on managing products, variants, and collections through the API.
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.
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
Hi Lam
This is helpful.
Thanks