How to hide stock quantity message for specific product tags?

Hello!

I currently have a message on product pages that say “we have * in stock”. Is there a way I can change it so it doesn’t show up if the product has a particular tag? I don’t want it to show up on products that are Preorders

{%- if settings.quantity_msg -%}
{%- assign enableqtyMsg = true -%}
{%- if current_variant.inventory_management == “shopify” and current_variant.inventory_quantity < settings.max_quantity and current_variant.inventory_quantity != 0 -%}
{%- assign enableqtyMsg = flase -%}
{%- endif -%}
{% assign qtyMsg = ‘products.product.quantity_message’ | t | split: ‘{{items}}’ %}

{{qtyMsg[0]}} {{product.selected_or_first_available_variant.inventory_quantity}} {{qtyMsg[1]}}
{% for variant in product.variants %}{{variant.inventory_quantity}}{% endfor %} {%- endif -%}

Just check if the "product.tags contains ‘your_tag’ "

hey thanks for the reply - can you elaborate a bit? I’ve tried placing that code in a few places with no change - I’m very new at this :slightly_smiling_face:

Hi @Nittiyarns ,

Hope you are doing well. Please change your snippet to:

{% for tag in product.tags %}

{% if tag contains ‘your_tab’ %}

{% assign has_preorder = true %}

{% endif %}

{% endfor %}

{% unless has_preorder == true %}

{%- if settings.quantity_msg -%}

{%- assign enableqtyMsg = true -%}

{%- if current_variant.inventory_management == “shopify” and current_variant.inventory_quantity < settings.max_quantity and current_variant.inventory_quantity != 0 -%}

{%- assign enableqtyMsg = flase -%}

{%- endif -%}

{% assign qtyMsg = ‘products.product.quantity_message’ | t | split: ‘{{items}}’ %}

{{qtyMsg[0]}} {{product.selected_or_first_available_variant.inventory_quantity}} {{qtyMsg[1]}}

{% for variant in product.variants %}{{variant.inventory_quantity}}{% endfor %}

{%- endif -%}

{% endunless %}

Remember: You need to change “your_tab” with the tag of that products.

Hope this helps. If you can not do that, you can add me as a staff, I’ll check it for you.

Works like a charm! Thanks so much for taking the time to help :slightly_smiling_face:

Hi,

I’ve been having a similar issue with a different application.

I am trying to differentiate between items I have “In stock” that I would rather have it say at the bottom “ships next day”

I also use a dropshipper to fulfill some items, which can take 1-3 weeks for delivery so I would rather those items say “Made to Order - Can take 1-3 weeks for domestic delivery”

I am having a ton of kickback from customers that are not reading our shipping policies and just because it says “in stock” at the bottom of the product page, they think it’s shipping next day.

Products I have in stock are all tagged with Factory_HK and all the dropshipped items are tagged with Factory_Printful

I found where it says “InStock” in the product-template.liquid file here but when I tried to change even just the wording of “InStock” it didn’t change so that’s even more confusing…

{%- endif -%}
“availability” : “http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}”,
“price” : {{ variant.price | divided_by: 100.00 | json }},
“priceCurrency” : {{ cart.currency.iso_code | json }},
“url” : {{ shop.url | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}

Any help would be greaty appreciated!

-Morgan

Hello again, thanks so much for answering last time. It works perfectly for my Preorder tag. I have now added an ‘incoming’ tag for when I have stock on order, and would like the same thing to happen for the Incoming tag. I have tried adding bits of code in to include Incoming just like you had with Preorder. I’ve tried copying your code and replacing ‘Preorder’ with ‘Incoming’, but it doesn’t work. Can you please help with how to do this? TIA!

Hey @LitExtension - Your previous reply works so well for the “preorder” tag. Are you able to help me adjust it so the same thing happens if the product has the tag ‘Incoming’ or ‘Supplier 0’? TIA!