shopwareshopware5

Shopware SEO URL with product options names in it


I want to have my product urls like this:

bla.com/product_name_bla_white_140cm

white & 140cm are options I can select at the given product.

I thought I can set it via SEO URL template:

{{ product.translated.name}}{%for opt in product.options %}_{{opt.name}}{%endfor%}

but with this setting, the url is like: bla.com/detail/261927b50317410ba8eecc97d77c3b7e

what is wrong?


Solution

  • In \Shopware\Storefront\Framework\Seo\SeoUrlRoute\ProductPageSeoUrlRoute::prepareCriteria the association for options and options.group are not loaded, so you won't be able to access this data. The easiest way would be to add these criteria by plugin.