Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shopware 6: How to display product name in breadcrumbs

We want to add the product name to the breadcrumb list when current page matches a product detail page. Unfortunately, it doesn't seem like the product is loaded yet when the breadcrumb is rendered. We have tried using dump() to see what variables are available and nothing related to the product.

Where should I look in order to include the product name in our breadcrumbs?

like image 719
Gitte Wange Olrik Avatar asked Oct 31 '25 13:10

Gitte Wange Olrik


1 Answers

Have a look at storefront/base.html.twig. There you will see, that currently the breadcrumb-template gets passed the context and the category. If you want to also use some product-information, you have to overwrite this block like this:

{% block base_breadcrumb %}
    {% sw_include '@Storefront/storefront/layout/breadcrumb.html.twig' with {
      context: context,
      category: page.product.seoCategory,
      product: page.product
    } only %}
{% endblock %}

Then you can use product in the breadcrumb-template.

like image 156
newgennerd Avatar answered Nov 04 '25 18:11

newgennerd