Indexing
...
Entities
Products

Custom Product Types

3min

Product types are injected via this virtualType Klevu\IndexingProducts\Service\Provider\EntityProviderProvider in the indexing products module etc/di.xml

magento2-plugin/module-m2-indexing-products/etc/di.xml


Merchants can add to this EntityProviderProvider e.g.

Vendor/Module/etc/di.xml


There are 2 ways in which this CustomTypeProvider can be generated.

1. (Recommended) Use virtualTypes, as the Klevu module does, and pass your custom productType e.g

Vendor/Module/etc/di.xml


2. Create a class. This is recommended if you need to filter the returned products on more than the product type. The provider must implement Klevu\IndexingApi\Service\Provider\EntityProviderInterface e.g.

Vendor/Module/etc/di.xml


Create the provider

Vendor/Module/Service/Provider/Discovery/ProductEntityCollection/CustomTypeProvider.php


Here ProductCustomTypeEntityCollection is a class that returns a collection of the custom product type.