By default, the Shopware 6 URLs for products are set like this:
{{ product.translated.name }}/{{ product.productNumber}}
=> /Product-Name/Number123
Category URLs look like this:
{% for part in category.seoBreadcrumb%}{{ part|lower }}/{% endfor %}
=> /parent-category/child-category
I would like to add the product's main category's path to the product URL like it was possible in SW5 with {sCategoryPath articleID=$sArticle.id}/{$sArticle.name}
=> /parent-category/child-category/product-name
Is there a way to achieve this in SW6?
You can do this out-of-the-box. Tested in Shopware 6.4.15.0:
{% for part in product.mainCategory.breadcrumb|slice(1)%}{{ part }}/{% endfor %}{{ product.translated.name }}/{{ product.productNumber }}
Will result in:
Category structure: