1

The products in Drupal Commerce 2 could not be found through Drupal's default search form.

Modules like Commerce Search are available only for Drupal 7.

How can I index product titles or SKUs and add them to the search in Drupal 8?

Thanks!

1 Answer 1

2

The core search will only ever search node's and users. If you want to search other entity types, like products, use Search API.

Just install the module, create a server (you can use the search api db submodule if you just want to use your sql database) and create your index. You will have the option of selecting which entity types get added to the index, you probably want nodes and products. Then add which ever fields that you want to be searchable.

See the official documentation for screenshots and more info on how to take it further (like adding facets).

5
  • I did all of these steps to set up product catalog, my facets are working fine but is there a way to display products while searching through Drupal's default search form or Search API is working only with views? Commented Jan 5, 2018 at 22:47
  • You would want to use Views/Search API to replace the default search.
    – Chance G
    Commented Jan 5, 2018 at 22:58
  • Thanks, I think it works fine for English but my current site is in Russian and the Search API is not working properly. It always shows ALL indexed products no matter what characters I enter in the search form. Commented Jan 6, 2018 at 15:09
  • My problem was not in the language but in the index settings. I've chosen Fulltext in the Type of the indexed field, and now it works. Commented Jan 7, 2018 at 21:00
  • AFAIU Search API does not support i18zed sites: drupal.org/project/search_api/issues/1323168
    – int_ua
    Commented Mar 3, 2021 at 11:43

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.