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

Highlighted
Shopify Partner
3 0 0

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 %}

<div class="product-quantity-box left">
<span class="ss-icon product-minus js-change-quantity" data-func="minus"><span class="icon-minus"></span></span>
<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 %} />
<span class="ss-icon product-plus js-change-quantity" data-func="plus"><span class="icon-plus"></span></span>
</div>

Any help would be greatly appreciated.

0 Likes
Highlighted
Shopify Partner
1012 209 253

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 %}
Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like
Highlighted
Shopify Partner
3 0 0

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 %}
<div class="container main content">
<a name="pagecontent" id="pagecontent"></a>
 
<div class="section clearfix">
  <div class="sixteen columns">
    <h1>{{ 'cart.general.title' | t }}</h1>
    <div class="feature_divider"></div>
  </div>
</div>
 <!-- <div id="discountMsg" class="blueAlert show">
         <h2><font color="white"><center>To be eligible for FREE SHIPPING in April orders must contain only badges, awards and patches. <br>Any additional items must be purchased on a separate order.</center></font></h2>
        </div>-->
 <!--  <div id="discountMsg" class="blueAlert show">
         <h2><font color="white"><center>Orders placed after Thursday, April 23<sup>rd</sup>, 2020 at 11:00 am CST will be processed <br>and shipped on the next business day (Monday April 27<sup>th</sup>, 2020).</center></font></h2>
        </div> -->
      <!--  <div class="blueAlert show">
           <h2>Reminder: Monday May 25th, 2020 We will be honoring the sacrifice of the great men and women who have paid the ultimate price for our Freedom. USPS, FedEx and UPS Home Delivery will not make deliveries that day. Any order placed this weekend and Monday will ship the next business day.</h2>
      </div>-->
  
             <!--   <div class="blueAlert show">
           <h2>Reminder: Orders placed between Tuesday, May 26th and Sunday, May 31st will ship beginning Monday, June 1st.</h2>      </div>
<div class='tabarnapp_discount_applied' style='display:none;'> A discount of <em>${discount_amount}</em> from <em>${discount_code}</em> coupon will be applied at checkout. <br /><br /> If checking PayPal below, please note your coupon code and add it to your cart prior <br /> to completeion of your order to get the discount.  </div>-->
<!--  <div class="blueAlert show">
           <h2> We will be closed Friday July 3rd to observe Independence Day. Orders placed July 3-5 will process on Monday July 6th.</h2>
      </div>-->
 
  <!-- Beginning of Spend More Save More cart messaging -->
  {% comment %} 
  {% if cart.total_price >= 5000 and cart.total_price < 10000 %}
  <div id="discountMsg" class="blueAlert show">
    <h2>You're saving 15% on this order! Spend another {{ 10000 | minus: cart.total_price | money }} to save 20%!</h2><br />
    <input type="hidden" name="discount" value="SAVE15%" >
  </div>
  {% elsif cart.total_price >= 10000 and cart.total_price < 15000 %}
  <div id="discountMsg" class="blueAlert show">
    <h2>You're saving 20% on this order! Spend another {{ 15000 | minus: cart.total_price | money }} to save 25%!</h2><br />
    <input type="hidden" name="discount" value="SAVE20%" >
  </div>
  {% elsif cart.total_price >= 15000 %}
  <div id="discountMsg" class="blueAlert show">
    <h2>You are saving 25% on this order! Discount coupon will be applied at checkout.</h2><br />
    <input type="hidden" name="discount" value="SAVE25%" >
  </div>
  {% else %}
  <div id="discountMsg" class="blueAlert show">
    <h2>Add {{ 5000 | minus: cart.total_price | money }} worth of products to your cart to get a 15% discount at checkout!</h2>
  </div>
  {% endif %}
  {% endcomment %}   
  <!-- End of Spend More Save More cart messaging --> 
<div class="saso-cart-offers"></div>
{% if cart.item_count == 0 %}
  <div class="sixteen columns">
    <div class="section clearfix">
      <div class="six columns offset-by-five medium-down--one-whole">
        <p class="quote">{{ 'cart.general.continue_browsing_html' | t }}</p>
 
        <a href="{% if cart.items.first.product.collections != blank %}{{ cart.items.first.product.collections.last.url }}{% else %}/collections/all{% endif %}" class="action_button continue-button add_to_cart">{{ 'cart.general.continue_shopping_link_html' | t }}</a>
      </div>
      <br class="clear" />
    </div>
  </div>
{% else %}
 
  <form action="/cart" method="post" id="cart_form">
    <div class="section clearfix">
      <div class="eleven columns medium-down--one-whole">
        
{% comment %}
        {% for item in cart.items %}
         {% if item.variant.sku == 'AHG1941' %}
              <div id="AHGBlanket">
                <h5>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.</h5>
              </div>
         {% 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 %}
 
          <div class="section clearfix" style="{% include 'product-customizer-helper' with 'hide-pricing-item-row' %}" {% include 'product-customizer-helper' with 'cart-row-data' %}>
            <div class="five columns alpha">
              <a href="{{ item.url }}" title="{{ item.title | escape }}" class="cart_page_image">
                {% include 'image-element', image: item, alt: item.title, object_fit: settings.align_height, max_height: settings.collection_height %}
              </a>
            </div>
 
            <div class="eleven columns omega cart_content_info">
              <h3>
                <a href="{{ item.url }}">{{ item.product.title }}
<!-- <span class="saso-cart-item-discount-notes" data-key="{{item.key}}"></span>
<span class="saso-cart-item-upsell-notes" data-key="{{item.key}}"></span> -->
                                </a>
              </h3>
 
              {% unless item.product.has_only_default_variant or item.variant.title contains "Title" %}
                <p class="meta">
                  {% for option in item.product.options %}
                    <span class="label">{{ option }}:</span> <span>{{ item.variant.options[forloop.index0] }}</span><br />  
                  {% endfor %}
                </p>
              {% endunless %}
              {{ item.sku }}
              
              {% include 'product-customizer-helper' %}
              
              {% comment %}
 
              {% if item.properties %}
                <p>
                  {% 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/' %}
                        <div>
                          {{ p.first }}: <a class="lightbox" href="{{ p.last }}">{{ 'cart.general.uploaded_file' | t }}</a>
                        </div>
                      {% else %}
                        <div>
                          {{ p.first }}: {{ p.last }}
                        </div>
                      {% endif %}
                    {% endunless %}
                  {% endfor %}
                </p>
              {% endif %}
              
              {% endcomment %}
 
              <p class="modal_price">
                {% if item.price > 0 %}
                  <span class="">{% comment %}
<span class="saso-cart-item-price" data-key="{{item.key}}">{{ item.price | money }}</span>
{% endcomment %}{% include 'product-customizer-helper' with 'item-price', items: cart.items %}</span>
                {% else %}
                  {{ settings.free_price_text }}
                {% endif %}
 
                {% if item.price < item.variant.compare_at_price %}
                  <span class="money was_price">{{ item.variant.compare_at_price | money }}</span>
                {% endif %}
              </p>
           
            {% comment %} Use this condition where you want to hide specefic element {% endcomment %}
              {% if has_tag  %}
              <div class="product-quantity-box left">
                <span class="ss-icon product-minus js-change-quantity" data-func="minus"><span class="icon-minus"></span></span>
                <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 %} />
                <span class="ss-icon product-plus js-change-quantity" data-func="plus"><span class="icon-plus"></span></span>
              </div>
              {% endif %}
            </div>
          </div>
        {% endfor %}
      </div>
 
      <div class="five columns medium-down--one-whole">
        <div class="section clearfix">
          <div class="subtotal cart-form">
            <p class="cart_subtotal js-cart_subtotal total">
              <span class="right">
                
<span class="saso-cart-original-total"><span class="">{{ cart.total_price | money }}</span></span>
<!-- <span class="saso-cart-total"></span>-->
 
              </span>
              <span>{{ 'cart.general.subtotal' | t }}</span>
            </p>
 
            {% if section.settings.display_savings %}
              <p class="cart_savings sale">
                {% if total_saving > 0 %}
                  <span class="right">
                    <span class="">{{ total_saving | money }}</span>
                  </span>
                  <span>{{ 'layout.general.savings' | t }}</span>
                {% endif %}
              </p>
            {% endif %}
 
            {% if settings.show_multiple_currencies %}
              <p>
                <small>
                  {{ 'cart.general.orders_processed_in_currency_html' | t: currency: shop.currency }}
                </small>
              </p>
            {% endif %}
 
            {% if section.settings.display_special_instructions %}
              <label for="note">{{ 'cart.general.note' | t: shop_name: shop.name }}:</label>
              <textarea id="note" name="note" rows="2">{{ cart.note }}</textarea>
            {% endif %}
 
            {% if settings.display_tos_checkbox %}
              <p>
                <input type="checkbox" class="tos_agree" id="cart_agree" required />
                  <label class="tos_label" for="cart_agree">
                    {{ 'cart.general.agree_to_terms_html' | t }}
                  </label>
                {% if settings.tos_page != blank %}
                  <a href="{{ pages[settings.tos_page].url }}" target="_blank" class="tos_icon">{{ 'cart.general.view_terms' | t }}</a>
                {% endif %}
              </p>
            {% endif %}
 
            {% if section.settings.cart_message != blank %}
              <div>
                {{ section.settings.cart_message }}
              </div>
            {% endif %}
{% if locksmith_access_granted %}
            <p>
              <button type="submit" class="action_button add_to_cart" id="checkout" name="checkout">{% if settings.show_lock_icon %}<span class="icon-lock"></span>{% endif %}{{ 'cart.general.checkout' | t }}</button>
            </p>
{% comment %}
            {% if content_for_additional_checkout_buttons %}
              <div class="additional-checkout-buttons">
                {{ content_for_additional_checkout_buttons }}
              </div>
            {% endif %}
            {% endcomment %}
{% else %}
  <p>Please sign in to checkout.</p>
{% endif %}
            {% if cart.item_count > 0 %}
              <div class="featured-links">
                <a href="{% if cart.items.first.product.collections != blank %}{{ cart.items.first.product.collections.last.url }}{% else %}/collections/all{% endif %}" class="secondary_button">{{ 'cart.general.continue_shopping_link_html' | t }}</a>
              </div>
            {% endif %}
          </div>
        </div>
      </div>
    </div>
  </form>
 
  {% include 'cart-shipping-calculator' %}
{% endif %}
 
</div>
 
<div class="cart__blocks">
  {% for block in section.blocks %}
    <div {{ block.shopify_attributes }} class="block__{{ block.type }} block__{{ block.id }}">
      {% if block.type == 'featured_collection' %}
        {% include 'include-featured-collection', type: 'block' %}
      {% endif %}
    </div>
  {% endfor %}
</div>
 
{% 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' %}
0 Likes
Highlighted
Shopify Partner
3 0 0

I figured it out! Thanks a million!

0 Likes