Removing all Sold Out badges from Spotlight theme

We use the Spotlight theme and would like to remove all Sold Out badges and Sold Out markings completely.

We have a Collection named Upcoming Releases. But they say SOLD OUT when their in-stock quantity is zero.

I’ve seen answers where it shows how to remove Sold Out badges for only specific Collections. But I really need to remove them completely and I can’t find any answers for how to do this.

Hi @accurail ,

May I suggest to update code these steps:

  1. Go to Store Online-> theme → edit code

  1. snippets/card-product.liquid

  2. find “card__badge”

  3. Refer screenshot below to remove code ( remember in card_product.lqiuid we have 2 positions to remove

  1. snippets/price.liquid

  2. Go to end of file and refer screenshot below to remove code

1 Like

Hi @accurail

You can add this code to your theme.liquid file, after from Online Store > Themes > Edit code


1 Like

Thank you very much for the replies. It’s worked to get rid of the badges which cover part of the item’s images.

However there are still light gray boxes beneath each item which say Sold Out.

Is there any way to get rid of those as well?

Or would I be better off making them disappear ONLY in our collection named ‘Upcoming Releases’?

Thank you again!

Hi,

  1. snippets/card-product.liquid → this one for collection page

  2. find “{% if quick_add == ‘standard’ %}”

  3. Refer screenshot below to add code

{%- if card_product.selected_or_first_available_variant.available -%}
{%-  endif -%}
  1. snippets/buy-buttons.liquid → for product details

  2. Refer screenshot below to add code

{%- if product.selected_or_first_available_variant.available -%}
{%-  endif -%}
1 Like

Sorry but this isn’t working. Some of the code I’m supposed to search for does not appear anywhere in the referenced files.

I even copy/pasted the entire page of code into Notepad and searched for segments of it in there.

First, Line 290 in the first image is already in there, and the code I’m supposed to add/replace it with is identical.

{%- if card_product.selected_or_first_available_variant.available -%} (Searched for and found)

{%- if card_product.selected_or_first_available_variant.available -%} (Replaced it with this)

So I guess that part is ok.. maybe?

But then the next image of text to add jumps all the way down to line #517, however mine only goes to Line 375.

There are a ton of lines that say {%- endif -%} and it looks like I’m supposed to add another {%- endif -%} ?

An identical one? Or it looks like it has more spaces between the %- and the endif. Or doesn’t it?

And where exactly am I supposed to add it?

Next, in the Snippets-buy-buttons.liquid file, I’m supposed to search for this:

{%- if product.selected_or_first_available_variant.available -%}

But it doesn’t appear anywhere in that file.

Once again, I copy/pasted it all into Notepad and it’s simply not in there.

Is it ok for me to to paste the code from my files into a new here so it can be looked at?

Hi,

Could you share code of 2 files?

  1. snippets/card-product.liquid

  2. snippets/buy-buttons.liquid

I will help apply code for you.

If you can share code. You can follow screenshot to send code?

Sure thing, thank you for helping. Here is snippets/card-product.liquid

{% comment %}
  Renders a product card

  Accepts:
  - card_product: {Object} Product Liquid object (optional)
  - media_aspect_ratio: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional)
  - image_shape: {String} Image mask to apply to the product image card. Values are "arch", "blob", "chevronleft", "chevronright", "diamond", "parallelogram", and "round". (optional)
  - show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
  - show_vendor: {Boolean} Show the product vendor. Default: false
  - show_rating: {Boolean} Show the product rating. Default: false
  - extend_height: {Boolean} Card height extends to available container space. Default: true (optional)
  - lazy_load: {Boolean} Image should be lazy loaded. Default: true (optional)
  - show_quick_add: {Boolean} Show the quick add button.
  - section_id: {String} The ID of the section that contains this card.
  - horizontal_class: {Boolean} Add a card--horizontal class if set to true. Default: false (optional)
  - horizontal_quick_add: {Boolean} Changes the quick add button styles when set to true. Default: false (optional)
  - placeholder_image: {String} The placeholder image to use when no product exists. Default: 'product-apparel-2' (optional)

  Usage:
  {% render 'card-product', show_vendor: section.settings.show_vendor %}
{% endcomment %}

{{ 'component-rating.css' | asset_url | stylesheet_tag }}
{{ 'component-volume-pricing.css' | asset_url | stylesheet_tag }}

{%- if card_product and card_product != empty -%}
  {%- liquid
    assign ratio = 1
    if card_product.featured_media and media_aspect_ratio == 'portrait'
      assign ratio = 0.8
    elsif card_product.featured_media and media_aspect_ratio == 'adapt'
      assign ratio = card_product.featured_media.aspect_ratio
    endif
    if ratio == 0 or ratio == null
      assign ratio = 1
    endif
  -%}
  
    

      

        {%- if card_product.featured_media -%}
          

            

              {% comment %}theme-check-disable ImgLazyLoading{% endcomment %}
              
              {% comment %}theme-check-enable ImgLazyLoading{% endcomment %}

              {%- if card_product.media[1] != null and show_secondary_image -%}
                
              {%- endif -%}
            

          

        {%- endif -%}
        
          

            ### 
              
                {{ card_product.title | escape }}
              
            
          

          
            {%- if card_product.available == false -%}
            {%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
              
                {{- 'products.product.on_sale' | t -}}
              
            {%- endif -%}
          

        

      

      
        

          ### 
            
              {{ card_product.title | escape }}
            
          
          
            {%- if show_vendor -%}
              {{ 'accessibility.vendor' | t }}
              
{{ card_product.vendor }}

            {%- endif -%}

            {{ block.settings.description | escape }}

            {%- if show_rating and card_product.metafields.reviews.rating.value != blank -%}
              {% liquid
                assign rating_decimal = 0
                assign decimal = card_product.metafields.reviews.rating.value.rating | modulo: 1
                if decimal >= 0.3 and decimal <= 0.7
                  assign rating_decimal = 0.5
                elsif decimal > 0.7
                  assign rating_decimal = 1
                endif
              %}
              

                
              

              

                
                  {{- card_product.metafields.reviews.rating.value }} /
                  {{ card_product.metafields.reviews.rating.value.scale_max -}}
                
              

              

                ({{ card_product.metafields.reviews.rating_count }})
                
                  {{- card_product.metafields.reviews.rating_count }}
                  {{ 'accessibility.total_reviews' | t -}}
                
              

            {%- endif -%}

            {% render 'price', product: card_product, price_class: '', show_compare_at_price: true %}
            {%- if card_product.quantity_price_breaks_configured? -%}
              
                {{ 'products.product.volume_pricing.note' | t }}
              

            {%- endif -%}
          

        

        {%- if show_quick_add -%}
          
            {%- liquid
              assign product_form_id = 'quick-add-' | append: section_id | append: card_product.id
              assign qty_rules = false
              if card_product.selected_or_first_available_variant.quantity_rule.min > 1 or card_product.selected_or_first_available_variant.quantity_rule.max != null or card_product.selected_or_first_available_variant.quantity_rule.increment > 1
                assign qty_rules = true
              endif
            -%}
            {%- if card_product.variants.size > 1 or qty_rules -%}
              
              
            {%- else -%}
              
            {%- endif -%}
          

        {%- endif -%}
        
          {%- if card_product.available == false -%}
          {%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
            
              {{- 'products.product.on_sale' | t -}}
            
          {%- endif -%}
        

      

    

  

{%- else -%}
  
    

      

        

          

            {%- if placeholder_image -%}
              {{ placeholder_image | placeholder_svg_tag: 'placeholder-svg' }}
            {%- else -%}
              {{ 'product-apparel-2' | placeholder_svg_tag: 'placeholder-svg' }}
            {% endif %}
          

        

      

      
        

          ### 
            
              {{ 'onboarding.product_title' | t }}
            
          
          
            {%- if show_vendor -%}
              {{ 'accessibility.vendor' | t }}
              
{{ 'products.product.vendor' | t }}

            {%- endif -%}
            {% render 'price', show_compare_at_price: true %}
          

        

      

    

  

{%- endif -%}

And here is snippets/buy-buttons.liquid

{% comment %}
  Renders product buy-buttons.
  Accepts:
  - product: {Object} product object.
  - block: {Object} passing the block information.
  - product_form_id: {String} product form id.
  - section_id: {String} id of section to which this snippet belongs.
  - show_pickup_availability: {Boolean} for the pickup availability. If true the pickup availability is rendered, false - not rendered (optional).

  Usage:
  {% render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true %}
{% endcomment %}

  {%- if product != blank -%}
    {%- liquid
      assign gift_card_recipient_feature_active = false
      if block.settings.show_gift_card_recipient and product.gift_card?
        assign gift_card_recipient_feature_active = true
      endif

      assign show_dynamic_checkout = false
      if block.settings.show_dynamic_checkout and gift_card_recipient_feature_active == false
        assign show_dynamic_checkout = true
      endif
    -%}

    
  {%- else -%}
    

      

        
      

    

  {%- endif -%}

  {%- if show_pickup_availability -%}
    {{ 'component-pickup-availability.css' | asset_url | stylesheet_tag }}

    {%- assign pick_up_availabilities = product.selected_or_first_available_variant.store_availabilities
      | where: 'pick_up_enabled', true
    -%}

    

    
  {%- endif -%}

Hi @accurail ,

/**** snippets/buy-buttons.liquid **/

{% comment %}
  Renders product buy-buttons.
  Accepts:
  - product: {Object} product object.
  - block: {Object} passing the block information.
  - product_form_id: {String} product form id.
  - section_id: {String} id of section to which this snippet belongs.
  - show_pickup_availability: {Boolean} for the pickup availability. If true the pickup availability is rendered, false - not rendered (optional).

  Usage:
  {% render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true %}
{% endcomment %}
{%- if product.selected_or_first_available_variant.available -%}

  {%- if product != blank -%}
    {%- liquid
      assign gift_card_recipient_feature_active = false
      if block.settings.show_gift_card_recipient and product.gift_card?
        assign gift_card_recipient_feature_active = true
      endif

      assign show_dynamic_checkout = false
      if block.settings.show_dynamic_checkout and gift_card_recipient_feature_active == false
        assign show_dynamic_checkout = true
      endif
    -%}

    
  {%- else -%}
    

      

        
      

    

  {%- endif -%}

  {%- if show_pickup_availability -%}
    {{ 'component-pickup-availability.css' | asset_url | stylesheet_tag }}

    {%- assign pick_up_availabilities = product.selected_or_first_available_variant.store_availabilities
      | where: 'pick_up_enabled', true
    -%}

    

    
  {%- endif -%}

{%-  endif -%}

/**** snippets/card-product.liquid **/

{% comment %}
  Renders a product card

  Accepts:
  - card_product: {Object} Product Liquid object (optional)
  - media_aspect_ratio: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional)
  - image_shape: {String} Image mask to apply to the product image card. Values are "arch", "blob", "chevronleft", "chevronright", "diamond", "parallelogram", and "round". (optional)
  - show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
  - show_vendor: {Boolean} Show the product vendor. Default: false
  - show_rating: {Boolean} Show the product rating. Default: false
  - extend_height: {Boolean} Card height extends to available container space. Default: true (optional)
  - lazy_load: {Boolean} Image should be lazy loaded. Default: true (optional)
  - show_quick_add: {Boolean} Show the quick add button.
  - section_id: {String} The ID of the section that contains this card.
  - horizontal_class: {Boolean} Add a card--horizontal class if set to true. Default: false (optional)
  - horizontal_quick_add: {Boolean} Changes the quick add button styles when set to true. Default: false (optional)
  - placeholder_image: {String} The placeholder image to use when no product exists. Default: 'product-apparel-2' (optional)

  Usage:
  {% render 'card-product', show_vendor: section.settings.show_vendor %}
{% endcomment %}

{{ 'component-rating.css' | asset_url | stylesheet_tag }}
{{ 'component-volume-pricing.css' | asset_url | stylesheet_tag }}

{%- if card_product and card_product != empty -%}
  {%- liquid
    assign ratio = 1
    if card_product.featured_media and media_aspect_ratio == 'portrait'
      assign ratio = 0.8
    elsif card_product.featured_media and media_aspect_ratio == 'adapt'
      assign ratio = card_product.featured_media.aspect_ratio
    endif
    if ratio == 0 or ratio == null
      assign ratio = 1
    endif
  -%}
  
    

      

        {%- if card_product.featured_media -%}
          

            

              {% comment %}theme-check-disable ImgLazyLoading{% endcomment %}
              
              {% comment %}theme-check-enable ImgLazyLoading{% endcomment %}

              {%- if card_product.media[1] != null and show_secondary_image -%}
                
              {%- endif -%}
            

          

        {%- endif -%}
        
          

            ### 
              
                {{ card_product.title | escape }}
              
            
          

          
            {%- if card_product.available == false -%}
            {%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
              
                {{- 'products.product.on_sale' | t -}}
              
            {%- endif -%}
          

        

      

      
        

          ### 
            
              {{ card_product.title | escape }}
            
          
          
            {%- if show_vendor -%}
              {{ 'accessibility.vendor' | t }}
              
{{ card_product.vendor }}

            {%- endif -%}

            {{ block.settings.description | escape }}

            {%- if show_rating and card_product.metafields.reviews.rating.value != blank -%}
              {% liquid
                assign rating_decimal = 0
                assign decimal = card_product.metafields.reviews.rating.value.rating | modulo: 1
                if decimal >= 0.3 and decimal <= 0.7
                  assign rating_decimal = 0.5
                elsif decimal > 0.7
                  assign rating_decimal = 1
                endif
              %}
              

                
              

              

                
                  {{- card_product.metafields.reviews.rating.value }} /
                  {{ card_product.metafields.reviews.rating.value.scale_max -}}
                
              

              

                ({{ card_product.metafields.reviews.rating_count }})
                
                  {{- card_product.metafields.reviews.rating_count }}
                  {{ 'accessibility.total_reviews' | t -}}
                
              

            {%- endif -%}

            {% render 'price', product: card_product, price_class: '', show_compare_at_price: true %}
            {%- if card_product.quantity_price_breaks_configured? -%}
              
                {{ 'products.product.volume_pricing.note' | t }}
              

            {%- endif -%}
          

        

        {%- if show_quick_add  and card_product.selected_or_first_available_variant.available -%}
          
            {%- liquid
              assign product_form_id = 'quick-add-' | append: section_id | append: card_product.id
              assign qty_rules = false
              if card_product.selected_or_first_available_variant.quantity_rule.min > 1 or card_product.selected_or_first_available_variant.quantity_rule.max != null or card_product.selected_or_first_available_variant.quantity_rule.increment > 1
                assign qty_rules = true
              endif
            -%}
            {%- if card_product.variants.size > 1 or qty_rules -%}
              
              
            {%- else -%}
              
            {%- endif -%}
          

        {%- endif -%}
        
          {%- if card_product.available == false -%}
          {%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
            
              {{- 'products.product.on_sale' | t -}}
            
          {%- endif -%}
        

      

    

  

{%- else -%}
  
    

      

        

          

            {%- if placeholder_image -%}
              {{ placeholder_image | placeholder_svg_tag: 'placeholder-svg' }}
            {%- else -%}
              {{ 'product-apparel-2' | placeholder_svg_tag: 'placeholder-svg' }}
            {% endif %}
          

        

      

      
        

          ### 
            
              {{ 'onboarding.product_title' | t }}
            
          
          
            {%- if show_vendor -%}
              {{ 'accessibility.vendor' | t }}
              
{{ 'products.product.vendor' | t }}

            {%- endif -%}
            {% render 'price', show_compare_at_price: true %}
          

        

      

    

  

{%- endif -%}
1 Like

It worked perfectly!

Thank you so much for the help. I very much appreciate it.