Show Product Type under Collections and Homepage

Hello,

I am trying to show the product type on collections and our homepage between the product title and the vendor. I also want it to be in h3. I am using the venue theme and my site is visible at thosewhobloom.com.

Thanks!

@thosewhobloom ,

Which theme you are working on ?

Hi @thosewhobloom ,

Please go to Actions > Edit code > Find ‘product’. Then send me screenshots of file names in snippets, I will help you check and find the correct file to add code.

Venue

Venue

@LitCommerce

1 Like

Hi @thosewhobloom ,

No, Venue is the theme name, I’m referring to the product item display file name.

Refer

Then I’ll help you find the exact file and add the code for it.

1 Like

Hi @thosewhobloom ,

Please send me the code of product-grid-item.liquid file, I will check and add it for you

1 Like

@LitCommerce

{% if settings.product_grid_label %}

{% assign custom_label = false %}
{% for collection in product.collections %}
{% if collection.title == collections[settings.product_grid_label_collection].title %}
{% assign custom_label = true %}
{% endif %}
{% endfor %}

{% assign new_label = false %}
{% assign product_created_at = product.created_at | date: ‘%s’ %}
{% assign time_ago = ‘now’ | date: ‘%s’ | minus: product_created_at | divided_by: 86400 %}
{% if time_ago < settings.product_grid_label_new_days %}
{% assign new_label = true %}
{% endif %}

{% if product.available == false %}

{{ 'products.product.sold_out' | t }}

{% elsif custom_label %}

{{ settings.product_grid_label_title }}

{% elsif product.compare_at_price > product.price %}
{% if settings.product_grid_label_sale_style == 'text' %}

{{ 'products.product.on_sale' | t }}

{% else %}

-{{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round }}%

{% endif %}
{% elsif new_label and settings.product_grid_label_new %}

{{ 'products.product.new' | t }}

{% endif %}

{% endif %}

{% case settings.product_grid_image_size %}
{% when ‘natural’ %}
{%- assign product_ratio = ‘custom’ -%}
{% when ‘fit-square’ or ‘crop-square’ %}
{%- assign product_ratio = ‘1:1’ -%}
{% when ‘fit-short’ or ‘crop-short’ %}
{%- assign product_ratio = ‘4:3’ -%}
{% when ‘fit-tall’ or ‘crop-tall’ %}
{%- assign product_ratio = ‘2:3’ -%}
{% endcase %}

{% if settings.product_grid_second_hover and product.images[1] != blank %}

{% endif %}

{%- assign img_url = product.featured_image.src | img_url: ‘1x1’ | replace: ‘1x1.', '{width}x.’ -%}
{{ product.featured_image.alt | escape }}

{{ product.featured_image.alt | escape }}

{% unless settings.product_grid_quick_buy == ‘disabled’ %}

{% if product.available == false %} {{ 'products.product.sold_out' | t }} {% elsif product.variants.size > 1 %} {{ 'products.product.select_options' | t }} {% else %} {% form 'product', product, class: "js-product-form" %} {{ 'products.product.add_to_cart' | t }} {% endform %} {% endif %}
{% endunless %}

{{ product.title }}

{% if settings.product_grid_vendor %}

{{ product.vendor }}

{% endif %}
{% if settings.product_grid_price %}

{% include 'product-price' %}

{% if product.available and product.selected_or_first_available_variant.unit_price_measurement %}

{% include 'product-unit-price', variant: product.selected_or_first_available_variant %}

{% endif %} {% endif %}

{% if settings.product_grid_swatch %}
{% include ‘product-grid-swatch’ %}
{% endif %}

{% if settings.product_reviews and settings.product_grid_reviews %}

{% endif %}

Hi @thosewhobloom ,

Please change code:


  {% if settings.product_grid_label %}

  
  {% assign custom_label = false %}
  {% for collection in product.collections %}
  {% if collection.title == collections[settings.product_grid_label_collection].title %}
  {% assign custom_label = true %}
  {% endif %}
  {% endfor %}

  
  {% assign new_label = false %}
  {% assign product_created_at = product.created_at | date: '%s' %}
  {% assign time_ago = 'now' | date: '%s' | minus: product_created_at | divided_by: 86400 %}
  {% if time_ago < settings.product_grid_label_new_days %}
  {% assign new_label = true %}
  {% endif %}

  {% if product.available == false %}
  

    

{{ 'products.product.sold_out' | t }}

  

  {% elsif custom_label %}
  
    

{{ settings.product_grid_label_title }}

  

  {% elsif product.compare_at_price > product.price %}
  
    {% if settings.product_grid_label_sale_style == 'text' %}
    

{{ 'products.product.on_sale' | t }}

    {% else %}
    

-{{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round }}%

    {% endif %}
  

  {% elsif new_label and settings.product_grid_label_new %}
  
    

{{ 'products.product.new' | t }}

  

  {% endif %}

  {% endif %}

  
    
      

        {% case settings.product_grid_image_size %}
        {% when 'natural' %}
        {%- assign product_ratio = 'custom' -%}
        {% when 'fit-square' or 'crop-square' %}
        {%- assign product_ratio = '1:1' -%}
        {% when 'fit-short' or 'crop-short' %}
        {%- assign product_ratio = '4:3' -%}
        {% when 'fit-tall' or 'crop-tall' %}
        {%- assign product_ratio = '2:3' -%}
        {% endcase %}

        

          

            

            {% if settings.product_grid_second_hover and product.images[1] != blank %}
            

            
            {% endif %}

            {%- assign img_url = product.featured_image.src | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
            
            

          

        

      

    

    {% unless settings.product_grid_quick_buy == 'disabled' %}
    

      {% if product.available == false %}
      {{ 'products.product.sold_out' | t }}
      {% elsif product.variants.size > 1 %}
      {{ 'products.product.select_options' | t }}
      {% else %}
      {% form 'product', product, class: "js-product-form" %}
      
      
      {% endform %}
      {% endif %}
    

    {% endunless %}
  

  
    

      ### {{ product.title }}
      
      ### {{ product.type }}

      {% if settings.product_grid_vendor %}
      #### {{ product.vendor }}
      {% endif %}

      
        {% if settings.product_grid_price %}
        

          {% include 'product-price' %}
        

        {% if product.available and product.selected_or_first_available_variant.unit_price_measurement %}
        

          {% include 'product-unit-price', variant: product.selected_or_first_available_variant %}
        

        {% endif %}
        {% endif %}

        {% if settings.product_grid_swatch %}
        {% include 'product-grid-swatch' %}
        {% endif %}

        {% if settings.product_reviews and settings.product_grid_reviews %}
        
          
        

        {% endif %}
      

    

  

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

1 Like

Thank you @LitCommerce !

@LitCommerce One last question. Would there be an easy way to have it displayed as (product type) from (vendor)?

Such as “Print from Jessica Roux”, all in the same line?

Or Postcard (type) from Jessica Roux (vendor) for example

Hi @thosewhobloom ,

Please find and change code here:

Code:

### {{ product.type }} from {{ product.vendor }}

Hope it helps!

1 Like

@LitCommerce Thanks so much! Worked perfectly.

1 Like