Removing Cart Quantity for certain tagged products in the TURBO (VERSION 4.1.2) theme

Hello,

We are looking to remove the quantity for certain products in our cart that are tagged with “mw_products”. We have the turbo theme and I believe this is the line of code that needs to change. I have tried adding this statement from another post and had now luck - {% unless product.tags contains ‘mw_products’ %}…{% endunless %}

0 and item.variant.inventory_policy == "deny" %}max="{{ item.variant.inventory_quantity }}"{% endif %} />

Any help would be greatly appreciated.

Hello,

You have implement this code a/to your need.

{% comment %} Place this code in start of file {% endcomment %}
{% assign has_tag = false %}
{% for item in cart.items %}
{% if item.product.tags contains 'solitaire' %}
   {% assign has_tag = true %}
{% endif %}
{% endfor %}

{% comment %} Use this condition where you want to hide specefic element {% endcomment %}
{% if has_tag  %}
     Place your code here which will remain hidden if product have specefic tag
{% endif %}
1 Like

Guleria,

Thank you. I put that in my code and it did not work. What am I doing wrong?

{% comment %} Place this code in start of file {% endcomment %}
{% assign has_tag = false %}
{% for item in cart.items %}
{% if item.product.tags contains ‘mw_products’ %}
{% assign has_tag = true %}
{% endif %}
{% include ‘locksmith-variables’ %}
{% comment %}
** Cart page - default view **

  • Template section
    {% endcomment %}

{% endfor %}

{{ 'cart.general.title' | t }}

{% comment %}
{% if cart.total_price >= 5000 and cart.total_price < 10000 %}

You're saving 15% on this order! Spend another {{ 10000 | minus: cart.total_price | money }} to save 20%!


{% elsif cart.total_price >= 10000 and cart.total_price < 15000 %}

You're saving 20% on this order! Spend another {{ 15000 | minus: cart.total_price | money }} to save 25%!


{% elsif cart.total_price >= 15000 %}

You are saving 25% on this order! Discount coupon will be applied at checkout.


{% else %}

Add {{ 5000 | minus: cart.total_price | money }} worth of products to your cart to get a 15% discount at checkout!

{% endif %} {% endcomment %}
{% if cart.item_count == 0 %}

{{ 'cart.general.continue_browsing_html' | t }}

{{ ‘cart.general.continue_shopping_link_html’ | t }}


{% else %}

{% comment %}
{% for item in cart.items %}
{% if item.variant.sku == ‘AHG1941’ %}

PLEASE NOTE: Your order contains the AHG Microfleece Creed Blanket. All orders containing the AHG Microfleece Creed Blanket will ship in early December. Your entire order will ship together via the method you choose at checkout.
{% endif %} {% endfor %} {% endcomment %}

{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign saving = item.variant.compare_at_price | minus: item.variant.price | times: item.quantity %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}

{{ item.product.title }}

{% unless item.product.has_only_default_variant or item.variant.title contains “Title” %}

{% for option in item.product.options %} {{ option }}: {{ item.variant.options[forloop.index0] }}
{% endfor %}

{% endunless %} {{ item.sku }}

{% include ‘product-customizer-helper’ %}

{% comment %}

{% if item.properties %}

{% for p in item.properties %}{% assign first_character_in_key = p.first | truncate: 1, '' %}{% if first_character_in_key == '_'%}{% continue %}{% endif %} {% unless p.last == blank %} {% if p.last contains '/uploads/' %}

{% else %}
{{ p.first }}: {{ p.last }}
{% endif %} {% endunless %} {% endfor %}

{% endif %}

{% endcomment %}

{% if item.price > 0 %} {% comment %} {{ item.price | money }} {% endcomment %}{% include 'product-customizer-helper' with 'item-price', items: cart.items %} {% else %} {{ settings.free_price_text }} {% endif %}

{% if item.price < item.variant.compare_at_price %}
{{ item.variant.compare_at_price | money }}
{% endif %}

{% comment %} Use this condition where you want to hide specefic element {% endcomment %}
{% if has_tag %}



<input type=“number” min=“0” size=“2” class=“quantity” name=“updates[]” id=“updates_{{ item.id }}” value=“{{ item.quantity }}” data-line-id=“{{ forloop.index }}” {% if settings.limit_quantity and item.variant.inventory_management != blank and item.variant.inventory_quantity > 0 and item.variant.inventory_policy == “deny” %}max=“{{ item.variant.inventory_quantity }}”{% endif %} />


{% endif %}

{% endfor %}

{{ cart.total_price | money }}

{{ 'cart.general.subtotal' | t }}

{% if section.settings.display_savings %}

{% if total_saving > 0 %} {{ total_saving | money }} {{ 'layout.general.savings' | t }} {% endif %}

{% endif %}

{% if settings.show_multiple_currencies %}

{{ 'cart.general.orders_processed_in_currency_html' | t: currency: shop.currency }}

{% endif %}

{% if section.settings.display_special_instructions %}
{{ ‘cart.general.note’ | t: shop_name: shop.name }}:

{{ cart.note }}

{% endif %}

{% if settings.display_tos_checkbox %}

{{ 'cart.general.agree_to_terms_html' | t }} {% if settings.tos_page != blank %} {{ 'cart.general.view_terms' | t }} {% endif %}

{% endif %}

{% if section.settings.cart_message != blank %}

{{ section.settings.cart_message }}
{% endif %} {% if locksmith_access_granted %}

{% if settings.show_lock_icon %}{% endif %}{{ 'cart.general.checkout' | t }}

{% comment %} {% if content_for_additional_checkout_buttons %}
{{ content_for_additional_checkout_buttons }}
{% endif %} {% endcomment %} {% else %}

Please sign in to checkout.

{% endif %} {% if cart.item_count > 0 %} {% endif %}

{% include ‘cart-shipping-calculator’ %}
{% endif %}

{% for block in section.blocks %}
{% if block.type == 'featured_collection' %} {% include 'include-featured-collection', type: 'block' %} {% endif %}
{% endfor %}

{% schema %}

{
“name”: “Cart page”,
“class”: “cart-section”,
“settings”: [
{
“type”: “checkbox”,
“id”: “display_special_instructions”,
“label”: “Show "note" text box”
},
{
“type”: “checkbox”,
“id”: “display_savings”,
“label”: “Show total savings”,
“default”: true
},
{
“type”: “richtext”,
“id”: “cart_message”,
“label”: “Cart message”
}
],
“blocks”: [
{
“type”: “featured_collection”,
“name”: “Featured collection”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Heading”,
“default”: “You may also be interested in”
},
{
“type”: “checkbox”,
“id”: “collection_description”,
“label”: “Show collection description”,
“default”: false
},
{
“type”: “collection”,
“id”: “collection”,
“label”: “Collection”
},
{
“type”: “radio”,
“id”: “collection_style”,
“label”: “Collection layout”,
“default”: “grid”,
“options”: [
{
“value”: “slider”,
“label”: “Slider”
},
{
“value”: “grid”,
“label”: “Grid”
}
]
},
{
“type”: “range”,
“id”: “products_per”,
“label”: “Products per row”,
“min”: 2,
“max”: 7,
“step”: 1,
“default”: 6
},
{
“type”: “range”,
“id”: “products_limit”,
“label”: “Limit products”,
“min”: 2,
“max”: 50,
“step”: 1,
“default”: 6
}
]
}
]
}

{% endschema %}

{% include ‘product-customizer-helper’ with ‘product-customizer-script’ %}

I figured it out! Thanks a million!