Want to show final sale tag on collection page

Hi there,
Hope you are doing well. I just want to show a ‘Final sale’ tag on collection page for products having product tag - final_sale.

Here i do the the same thing through if condition for product page .

{% if product.tags contains ‘final_sale’ %}

FINAL SALE

This Product cannot be returned or exchanged unless faulty.

{% endif %}

But this same logic cannot be applied on collection page.

1 Like

Hello @creative6262

Use this one code for collection page.

{% for product in collection.products %}
  {% if product.tags contains 'final_sale' %}
    
      ### FINAL SALE
      

This product cannot be returned or exchanged unless faulty.

    

  {% endif %}
{% endfor %}

Its showing like this.

{% comment %}
  pass in :

  * prod (product but avoiding collision with globally scoped product)
{% endcomment %}
{%- liquid
  assign show_multiple_images = false
  if settings.product_listing_show_second_image_on_hover and prod.media.size > 1
    assign show_multiple_images = true
  endif

  assign current_variant = prod.selected_or_first_available_variant

  case product_columns
    when '5'
      assign sizes = '(max-width: 720px) calc((90vw - 12px) / 2), (max-width: 1400px) calc((93.4vw - (12px * 3)) / 5), 270px'
    when '3'
      assign sizes = '(max-width: 720px) calc((90vw - 12px) / 2), (max-width: 1400px) calc((93.4vw - (12px * 3)) / 3), 450px'
    when '2'
      assign sizes = '(max-width: 720px) calc((90vw - 12px) / 2), (max-width: 1400px) calc((93.4vw - (12px * 3)) / 2), 690px'
    else
      # Using a 4 item grid as default for sizes
      assign sizes = '(max-width: 720px) calc((90vw - 12px) / 2), (max-width: 1400px) calc((93.4vw - (12px * 3)) / 4), 304px'
  endcase

  assign has_hover_swatches = false
-%}

{% if settings.enable_product_card_swatches %}
  {% capture first_swatchified_option %}{%- render "get-first-swatchified-option" with prod: prod -%}{%- endcapture -%}

  {% capture displayed_swatch_count %}{% render "get-variant-count-for-option" with prod: prod, option_name: first_swatchified_option %}{% endcapture %}
  {% assign displayed_swatch_count = displayed_swatch_count | plus: 0 %}

  {% if displayed_swatch_count != 0 %}
    {% assign has_hover_swatches = true %}
  {% endif %}
{% endif %}

  

    

      
        {%- if show_multiple_images -%}
          {%
            render 'image' with
            image: prod.media[0].preview_image,
            wrapper_class: 'product-item__image product-item__image--one',
            aspect_ratio: settings.product_listing_aspect_ratio,
            object_fit: settings.product_listing_media_fit
            include_placeholder: true,
            sizes: sizes
            src_set_type: "grid"
          %}
          {%
            render 'image' with
            image: prod.media[1].preview_image,
            wrapper_class: 'product-item__image product-item__image--two',
            aspect_ratio: settings.product_listing_aspect_ratio,
            object_fit: settings.product_listing_media_fit
            include_placeholder: true,
            sizes: sizes,
            no_lazy_load: true,
            src_set_type: "grid"
          %}
        {%- else -%}
          {%
            render 'image' with
            image: prod.featured_media,
            wrapper_class: 'product-item__image',
            aspect_ratio: settings.product_listing_aspect_ratio,
            object_fit: settings.product_listing_media_fit,
            include_placeholder: true
            include_placeholder: true,
            sizes: sizes
            src_set_type: "grid"
          %}
        {%- endif -%}
      
      {% unless placeholder %}
        {%-
          render 'product-badges'
          with prod: prod,
          show_sale_badge: settings.product_listing_show_sale_badge,
          show_custom_badges: settings.product_listing_show_custom_badges,
          show_sold_out_badge: settings.product_listing_show_sold_out_badge
        -%}
      {% endunless %}

      {% if settings.enable_quick_view and quick_view_is_beneath != true %}
        

          
        

      {% endif %}

      {% if settings.enable_quick_view %}
        
      {% endif %}
    

    
      

        #### 
          {%- if placeholder -%}
            {{ 'homepage.onboarding.product_title' | t }}
          {%- else -%}
            {{ prod.title }}
          {%- endif -%}
         
        

        {% if settings.product_listing_show_vendor and prod.vendor %}
          ##### 
            {{ prod.vendor }}
          
        {% endif %}

        {% if settings.product_listing_show_rating %}
          {% render 'product-rating', prod: prod %}
        {% endif %}

        

          
          {% if placeholder %}
            {{ 9999 | money }}

          {% elsif prod.compare_at_price > prod.price %}
            {{ 'products.product.regular_price' | t }}
            ~~{{ prod.compare_at_price | money }}~~

            {% if prod.price_varies %}
              {%- assign sale_price = prod.price | money -%}
              {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
            {% else %}
              {{ prod.price | money }}
          
            {% endif %}
          

          {% else %}
            {% if prod.price_varies %}
              {%- assign price = prod.price | money -%}
              {{ 'products.product.from_lowest_price_html' | t: lowest_price: price }}
            {% else %}
              {{ prod.price | money }}
            {% endif %}
          {% endif %}

          {% if settings.product_listing_show_discount %}
            
              {%-
                render "get-display-discount"
                with prod: prod,
                format: settings.product_listing_discount_format
              -%}
            
          {% endif %}

          {% render 'unit-price', item: current_variant %}
     
                {% if product.tags contains 'final_sale' %}
              

                

FINAL SALE

              

              {% endif %}
       
        

        {% if has_hover_swatches %}
          ##### 
            {{ 'products.product.swatch_count' | t: count: displayed_swatch_count }}
          
        {% endif %}
      

      {%- if has_hover_swatches -%}
        
          {%- render 'product-item-swatches' with prod: prod, option_name: first_swatchified_option -%}
        

      {%- endif -%}

      {%- if settings.enable_quick_view and quick_view_is_beneath -%}
        
      {%- endif -%}