How can I fix breadcrumb logic on my Warehouse theme?

I’m using Warehouse theme and it has a weird logic to its breadcrumb trail.

For example:
If I go from the Home page to Shop (all products collection) to any category (secondary collection) and then to any product the trail shows:
Home>All Products>Product Name
instead of
Home>Shop>Category Name>Product Name

Ideally, I want each category to have a trail Home>Shop>Category Name and each product Home>Shop>Category Name>Product Name

Does anyone know how to fix it?

1 Like

@socreative

This is code customization Work please hire shopify expert.

Thanks!

Is this going from a collection with tag filtering to a product?

In which case the collection url never changes from /collection/all.

Otherwise the theme and code would need to be reviewed to find why the logic is that way.

In some themes it is this way because there is a previous/next feature that allows customers to page through collection products on the product page itself.

One work around for some online-store-2.0 themes is to disable the breadcrumb and add a custom-liquid section using breadcrumb code such as from the partner snippets:

https://shopify.github.io/liquid-code-examples/example/breadcrumb-navigation

1 Like

Thank you for your response.

The theme developers did a quick fix for now but I’ll definitely look more into your suggestion.

Hi, we configured the Warehouse theme to achieve this:

In the product-item.liquid we added:

{%- liquid
if collection
assign product_url = product.url | within: collection
else
assign product_url = product.url
endif
-%}

and replaced all {{ product.url }} with {{ product_url }} in the file.

In the main-collection.liquid and main-product.liquid

we replaced (starting line 46):


with this code:


{%- unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' -%}
{%- assign t = template | split: '.' | first -%}

{%- endunless -%}
3 Likes

Amazing! thanks for sharing. That worked perfectly and I know have beautiful breadcrumbs that make sense for my warehouse theme. Thanks!