How to Add and Customize Product Tags on Shopify

Published on Jul 19, 2024

By Sophia Rodriguez

#Shopify#E-commerce#Web Development
Person Using Black And White Smartphone and Holding Blue Card

Are you looking to enhance your Shopify store’s product pages by displaying product tags? Adding tags can improve navigation, boost SEO, and help customers find related products more easily. In this comprehensive guide, we’ll walk you through the process of adding product tags to your Shopify store using the Venture theme, and provide some tips for customizing their appearance.

Understanding Product Tags in Shopify

What are Product Tags?

Product tags are keywords or phrases associated with your products that help categorize and organize your inventory. They can be used for filtering, searching, and creating collections in your Shopify store.

Benefits of Displaying Product Tags

Displaying product tags on your product pages offers several advantages:

  1. Improved navigation for customers
  2. Enhanced SEO through relevant keywords
  3. Easy access to related products
  4. Better organization of your product catalog

Where to Display Product Tags

Typically, product tags are displayed beneath the product description or at the bottom of the product page. This placement allows customers to easily find and click on tags to explore similar items.

Adding Product Tags to Your Shopify Store

Accessing Your Theme Files

To add product tags to your Shopify store, you’ll need to edit your theme files. Here’s how to get started:

  1. Go to your Shopify admin panel
  2. Navigate to “Online Store” > “Themes”
  3. Find your current theme (in this case, Venture)
  4. Click “Actions” > “Edit code”

Locating the Product Template

Once you’re in the theme editor, follow these steps:

  1. In the left sidebar, look for the “Sections” folder
  2. Find and click on the “product-template.liquid” file

Adding the Product Tags Code

Now that you’ve located the right file, it’s time to add the code for displaying product tags. Here’s the most effective solution:

{% if product.tags.size > 0 %}
  <div class="product-tags">
    <h4>Tags:</h4>
    <ul>
      {% for tag in product.tags %}
        <li>
          <a href="/collections/all/{{ tag | handle }}">{{ tag }}</a>
        </li>
      {% endfor %}
    </ul>
  </div>
{% endif %}

Add this code snippet to your “product-template.liquid” file where you want the tags to appear. This code creates a list of clickable tags that link to collections filtered by each tag.

Customizing the Appearance of Product Tags

Basic Styling with CSS

To make your product tags more visually appealing, you can add some CSS styling. Here’s a simple example to get you started:

.product-tags {
  margin-top: 20px;
}

.product-tags ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.product-tags li {
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 10px;
}

.product-tags a {
  display: block;
  padding: 5px 10px;
  background-color: #f0f0f0;
  color: #333;
  text-decoration: none;
  border-radius: 3px;
  transition: background-color 0.3s ease;
}

.product-tags a:hover {
  background-color: #e0e0e0;
}

Add this CSS to your theme’s stylesheet or in a “ tag within the “product-template.liquid” file.

Creating Button-like Tags

If you prefer a more button-like appearance for your tags, you can modify the CSS:

.product-tags a {
  display: inline-block;
  padding: 8px 16px;
  background-color: #ff69b4; /* Pink accent color */
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  transition: background-color 0.3s ease;
}

.product-tags a:hover {
  background-color: #ff1493; /* Darker pink on hover */
}

This CSS will create rounded, pink buttons for your tags, similar to the example you mentioned.

Advanced Customization Options

Filtering Specific Tags

If you want to display only certain tags, you can modify the Liquid code to filter them:

{% assign allowed_tags = "color,size,material" | split: "," %}
{% for tag in product.tags %}
  {% if allowed_tags contains tag %}
    <li>
      <a href="/collections/all/{{ tag | handle }}">{{ tag }}</a>
    </li>
  {% endif %}
{% endfor %}

This code will only display tags that match the ones specified in the allowed_tags variable.

Changing the Sort Order of Tagged Products

To change how tagged products are sorted when a customer clicks on a tag, you can modify the URL in the tag links:

<a href="/collections/all/{{ tag | handle }}?sort_by=best-selling">{{ tag }}</a>

This example sorts products by best-selling when a tag is clicked. You can replace “best-selling” with other sort options like “price-ascending” or “created-descending”.

Troubleshooting Common Issues

Tags with Spaces

If you have tags with spaces, you may encounter issues with the URLs. To fix this, use the handle filter in your Liquid code:

<a href="/collections/all/{{ tag | handle }}">{{ tag }}</a>

This will ensure that tags with spaces are properly formatted in the URL.

Tags Not Displaying

If your tags aren’t showing up, double-check that:

  1. You’ve added the code to the correct file (product-template.liquid)
  2. Your products actually have tags assigned to them
  3. There are no syntax errors in your Liquid code

Styling Issues

If your tags don’t look right, make sure your CSS is properly linked to your theme. You may need to add it to your theme’s main CSS file or use the theme customizer to add custom CSS.

By following this guide, you should now be able to display product tags on your Shopify store’s product pages using the Venture theme. Remember to always back up your theme before making changes, and test your modifications thoroughly to ensure everything works as expected.

Take Our Quick Quiz:

Which primary product image do you think has the highest conversion rate?