Liquid, JavaScript, themes, sales channels
Hihi. I need help with this.
I want to have a product in my shop that people can not ad to cart (they have to have contact with us)
How do I do that?
Brg Karitas
Hi.
A suggestion would be to a tag on the product you do not want to show the "add to cart" button.
Then on the product page (liquid) add something like the example below.
Most likely: product-template.liquid
Tag: no_atc
Top of the page add (liquid)
{% comment %} Check tag to hide ATC button {% endcomment %}
{% assign show_button = 1 %}
{% for tag in product.tags %}
{% if tag == "no_atc" %}
{% assign show_button = 1 %}
{% endif %}
{% endfor %}
Then further down the page find the Add To Cart button or Buy Now.
{% if show_button == 1 %}
<!--== This is from Debut ===-->
<button type="submit" name="add"
{% unless current_variant.available %} aria-disabled="true"{% endunless %}
aria-label="{% unless current_variant.available %}{{ 'products.product.sold_out' | t }}{% else %}{{ 'products.product.add_to_cart' | t }}{% endunless %}"
class="btn product-form__cart-submit{% if section.settings.enable_payment_button %} btn--secondary-accent{% endif %}"
data-add-to-cart>
<span data-add-to-cart-text>
{% unless current_variant.available %}
{{ 'products.product.sold_out' | t }}
{% else %}
{{ 'products.product.add_to_cart' | t }}
{% endunless %}
</span>
<span class="hide" data-loader>
{% include 'icon-spinner' %}
</span>
</button>
{% else %}
<!--== Add other stuff here on ATC ===-->
{% endif %}
This will allow you to turn the ATC button on and off via a product tag "no_atc" or whatever you end up using.
Regards,
Jon
Shopify Dev help: jcbellc.com
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024