I want to remove the add to cart button for a particular vendor

We aren’t allowed to sell a certain suppliers products online but still want customers to see what we have in store and sizes available. I had originally created a new product.notavailable template and section a deleted the below code but it doesn’t show the sizes out of stock.

I’m thinking the easiest way to do this would be editing the below code so the add to cart button is disabled for this particular vendor but can’t work out the correct statement to make it work.

Any help would be appreciated!

{% if product.available %}

{{ ‘products.product.add_to_cart’ | t }}

{% else %}

{{ ‘products.product.sold_out’ | t }}

{% endif %}
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}

hi @StateOfSolace

I am using your same code.
do this validation to hide the button if it is the provider you want to hide.
note: keep in mind upper and lower case

{% if product.available %}
       {% unless product.vendor == 'JkoDesignsr' %}
             
      {% endunless %}
{% else %}

{% endif %}
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}

{% unless product.vendor == ‘JkoDesignsr’ %}

This code validates if your provider is the one you chose, if it is not, it shows the button

1 Like

This probably isn’t the best solution but it seems to be working for me now!

{% if product.vendor == ‘vendor name’ %}

We are unable to sell vendor name via our online store, however we can still assist you via a remote shopping experience. Please chat to our friendly team via the chat box, call us on .....

...

{% else if product.available %} {{ 'products.product.add_to_cart' | t }} {% else %} {{ 'products.product.sold_out' | t }} {% endif %} {% if product.vendor == 'vendor name' %}

{% else if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}

@StateOfSolace

if it works well, in the publication you did not mention that you wanted to place a text. but that validation works fine.

1 Like

@StateOfSolace

it looks better that way

{% if product.available %}
       {% if product.vendor == 'NAME OF VENDOR' %}
        

   text for customers 

      {% else %}
             
      {% endif %}
{% else %}

{% endif %}
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}
1 Like

If you liked my answer, like it
If I solved your question, click Accept as a solution

Hi!

I am looking for the same solution as I have the same problem. I was wondering where you put the code? :slightly_smiling_face:

hello @Nuffe
This part of code can be placed in product-template-liquid, depending on what theme you are using, some themes vary, but most use product-template.
Now look for the part of the code for the add to cart buttons and place it there. Remember to work on a copy before making a major change.
find {{ ‘products.product.add_to_cart’ | t }}
or {{ form | payment_button }}
and you will find that part of the code..

1 Like

Thank you so much for helping!

I use the Prestige theme. I have these:

Which one is the same as the product.liquid? :slightly_smiling_face:

I don’t have that theme, check the files

Sections / main-product.liquid

snippets / product-form.liquid

snippets / product-item.liquid

1 Like

Thank you! Do I need to find the codes you send above in one of these and paste it besides this?

I have this code, but I do not know where to put it:
I use the prestige theme:)

{% if product.vendor == ‘vendor name’ %}

We are unable to sell vendor name via our online store, however we can still assist you via a remote shopping experience. Please chat to our friendly team via the chat box, call us on .....

...

{% else if product.available %} {{ 'products.product.add_to_cart' | t }} {% else %} {{ 'products.product.sold_out' | t }} {% endif %} {% if product.vendor == 'vendor name' %}

{% else if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}

find {{ ‘products.product.add_to_cart’ | t }}
or {{ form | payment_button }}

in each file sections or snippets
and you will find that part of the code..