How can I make product breadcrumbs depend on menu structure?

Topic summary

A user is attempting to create product breadcrumbs that automatically reflect their custom menu hierarchy, which includes multiple category levels. They’ve shared an image showing their menu structure and included code they’re currently using for breadcrumbs.

Current Issue:

  • The existing breadcrumbs don’t display child categories properly
  • The code appears to be reversed or encoded in some sections

Follow-up Problem:
Another user (Sisalla) reports a similar issue where:

  • Two-level menus work correctly
  • Three-level menus are missing the second-level breadcrumb
  • At line 164, both variables cb2_sibling_link and linklists[cb2_parent_list_handle].links are returning empty values

Status:
The discussion remains open with no resolution. The root cause of why these variables are empty in multi-level menu structures is unclear, and participants are seeking technical guidance on properly mapping menu hierarchy to breadcrumb navigation.

Summarized with AI on November 25. AI used: claude-sonnet-4-5-20250929.

we have created a small menu with the hierarchy of the categories

you can see it in the picture above so we thought maybe its possible that the product breadcrumbs depend on the structure of the menu… so the breadcrumbs would include every category in the right order because there are no child categories in the breadcrumbs I have right now.

This is the code I’m using for my breadcrumbs right now:


{%- comment -%}
  Documentation - http://docs.shopify.com/support/your-website/navigation/creating-a-breadcrumb-navigation
{%- endcomment -%}
{%- unless template == 'index' or template == 'cart' -%}

{%- endunless -%}

Hello Ali, are the breadcrumbs working well on your website?

I’m struggling with the code, the menus with 2 levels are working well but on the 3-level menus the breadcrumb of the second level is missing.

In line 164 ({%- for bc2_sibling_link in linklists[bc2_parent_list_handle].links -%}) are both the ‘bc2_sibling_link’ and ‘linklists[bc2_parent_list_handle].links’ are empty and I don’t understand why. Do you?

Best regards,
Jeanet

1 Like