Adding breadcrumbs to product page

jdn7d
Tourist
13 0 2

I'm trying to add breadcrumbs when you are on the product page. I tried some other solutions I saw here, like adding some code to the top of product-template, but it didn't work. I'm using the District theme, I'm not sure if that helps. Thank you in advance. 

0 Likes
HardikDavra
Shopify Partner
2253 350 967

Hello,

Welcome to the shopify Community.

It seems that I need to enter into your store to do coding.
Would you mind providing me collaborate access so that I can identify the problem?

 

PageFly - TOP5 in the Shopify app store. Learn More.

For fast Communication: Email: parambabla.soft@gmail.com | Whatsapp
0 Likes
jdn7d
Tourist
13 0 2

I'm not the owner of the store so I don't have the ability to do that. If you saw my product-template.liquid file, would that help?

0 Likes
HardikDavra
Shopify Partner
2253 350 967

Please add below code in the beginning of product-template.liquid file

{% unless template == 'index' or template == 'cart' or template == 'list-collections' %}
  <nav class="breadcrumb" role="navigation" aria-label="breadcrumbs">
    <a href="/" title="Home">Home</a>
    {% if template contains 'page' %}
      <span aria-hidden="true">&rsaquo;</span>
      <span>{{ page.title }}</span>
    {% elsif template contains 'product' %}
    {% if collection.url %}
      <span aria-hidden="true">&rsaquo;</span>
      {{ collection.title | link_to: collection.url }}
    {% endif %}
    <span aria-hidden="true">&rsaquo;</span>
    <span>{{ product.title }}</span>
    {% elsif template contains 'collection' and collection.handle %}
      <span aria-hidden="true">&rsaquo;</span>
      {% if current_tags %}
        {% capture url %}/collections/{{ collection.handle }}{% endcapture %}
        {{ collection.title | link_to: url }}
        <span aria-hidden="true">&rsaquo;</span>
        <span>{{ current_tags | join: " + " }}</span>
      {% else %}
        <span>{{ collection.title }}</span>
      {% endif %}
    {% elsif template == 'blog' %}
      <span aria-hidden="true">&rsaquo;</span>
      {% if current_tags %}
        {{ blog.title | link_to: blog.url }}
        <span aria-hidden="true">&rsaquo;</span>
        <span>{{ current_tags | join: " + " }}</span>
      {% else %}
        <span>{{ blog.title }}</span>
      {% endif %}
    {% elsif template == 'article' %}
      <span aria-hidden="true">&rsaquo;</span>
      {{ blog.title | link_to: blog.url }}
      <span aria-hidden="true">&rsaquo;</span>
      <span>{{ article.title }}</span>
    {% else %}
      <span aria-hidden="true">&rsaquo;</span>
      <span>{{ page_title }}</span>
    {% endif %}
  </nav>
{% endunless %}
PageFly - TOP5 in the Shopify app store. Learn More.

For fast Communication: Email: parambabla.soft@gmail.com | Whatsapp
0 Likes
LitExtension
Shopify Partner
926 109 161

Hi @jdn7d

If your theme does not show breadcrumbs on your product page. You can try to use this snippet: {% render 'breadcrumbs' %}

If you can not do that, you can add me as a staff. I'll check it for you (my email: jones.evan137@gmail.com)

LitExtension - Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes
jdn7d
Tourist
13 0 2

Thank you, but that didn't help. For security reasons, I'm not allowed to add anyone to the project. Let me know if you have any other ideas though.

0 Likes