I've had experience creating product catalogues in Drupal 7, but this is my first time using Drupal 8.

I have some categories defined as a taxonomy, and I simply want to create category pages that show the products in that category, with a friendly URL, e.g.:


I'm not expecting anyone to explain the full process, but I'm hoping someone has a link to a decent guide/tutorial as so far hours of Googling hasn't uncovered anything.

The official Commerce documentation goes into making search pages and using facades and filters, but I don't need anything that complicated.

  • D7 tutorials should apply, taxonomy hasn't changed much between D7 and D8. Commented Feb 7, 2019 at 23:40

1 Answer 1


The easiest way to do this is just create a view using a page display if you did not know you can use dynamic replacement in your views page urls

aka "This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term" - copied direct from views (page) PAGE SETTINGS - path.

so you would set the path to be "/products/%taxonomy_term"

then in views "ADVANCED", CONTEXTUAL FILTERS you would add taxonomy term filter you can look at "yoursite.com/admin/structure/views/view/taxonomy_term" . for a better idea on how to do this...

if all this sounds hard please look into creating filters: example https://www.youtube.com/watch?v=aVwclF9TfBo

NOTE: this will use the term_id as there is no default filter for term name if you want to use the term name ... then follow https://evolvingweb.ca/blog/how-create-custom-views-argument-plugin-drupal-8

or In a nutshell with no code:

  1. Add a new field to your term and call it URL To Access of type plain text and make it required. Edit your terms and in the URL To Access field you would enter for a example "t-shirt" or "pants" or "what-ever-you-are-selling".
  2. On your product type add the term reference field such as "Category"
  3. Edit products to make sure they have a value for the "Category" field
  4. Make New View of type product with page display and url "/products/%"
  5. Add RELATIONSHIPS of the field "Category" and require that relationship
  6. Add a CONTEXTUAL FILTER for the field field URL To Access. Inside the settings do the followin:
    a From the 'WHEN THE FILTER VALUE IS NOT IN THE URL' section
    b Click on 'Provide default value'
    c Then from the 'Type' dropdown select "Raw value from URL"
    d And from the 'Path component' dropdown select "2"

then save it.

You can now go to : /products/t-shirt and see the products under this category.

  • estore theme has an example setup in estore/config/optional/views.view.products.yml which can be imported at /admin/config/development/configuration/single/import. But it requires adding l10n filter and Distinct setting manually in case your site is i18zed.
    – int_ua
    Commented Sep 24, 2020 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.