How can I correctly add sub category breadcrumbs to my online store?

Hi

I am trying to add breadcrumbs to my store. I have searched a lot online, probably too much as I am not confused :slightly_smiling_face:

I have sub categories for my products for example Home Page dropdown menu for Cars, Trucks, Bikes, Rollers.

In the cars for example I have fast cars, slow cars, static cars.

When I implement the code below in the snippets and then place it in the Theme.liquid I only get the breadcrumb, home page - all products - slow cars when I am in slow cars but I would need to have home page - cars - slow cars so I can get back to cars.

When I press on the link for all products it gives me an error anyway but it is not useful to have.

Do I have to do something in the main.product.liquid instead of the theme.liquid?

Thank you to anyone for your kind support

Hello @KOBFFT ,

theme.liquid is fine for breadcrumbs.You have to write additional code. A logic if collection contains.
btw can you share the store URL to check your exact customization requirement to provide a guideline.

Thanks

Hi Guleria,

Thanks for replying.

I followed all of the instructions in the following guide:

Building an Accessible Breadcrumb Navigation with Liquid and Shopify Canada

I believe there is logic in this for product and for collections?

Is there something more specific that I need to do?

In relation to the URL, I copied my theme to a duplicate for testing this. The store is not yet live. Is that the one you are referring to?

Thank you for any help