Can you prevent adding items to cart in Shopify?

Karitas
Visitor
2 0 0

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

Reply 1 (1)

Jon_Chambers
Excursionist
27 2 2

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