Skip to content

CatalogModule

Module in @evolve-framework/commercetools

The catalog on commercetools: products by id, slug or SKU, categories, a category page by its path, and productSearch.

import { CatalogModule } from "@evolve-framework/commercetools";

Serves the Catalog part of the GraphQL API: categories, product, productCategoryPageByPath, products, productsBySku, productSearch, productSearchMaxResults, productSearchSuggestions, productSortOrders.

new CatalogModule(options: CatalogModuleOptions)
OptionTypeDescription
clientFactoryClientFactory

The commercetools client its requests to the project go through, built with ClientFactory.create.

search?SearchProvider

Where product search is answered from. Defaults to commercetools' own product search.

More

Any search engine plugs in here by wrapping its adapter:

new CatalogModule({
	clientFactory,
	search: new DocumentSearchProvider({
		adapter: new AlgoliaQueryAdapter({ appId, searchApiKey }),
	}),
});
variantDimensions?VariantDimensionsConfig

Which attributes the variants of a product vary on, keyed by product type key. A project knows its own product types, so pass them here; omitting it falls back to the demo product types.

searchCacheTtl?number

How long commercetools' own product search responses are cached, in milliseconds. Omitted or 0 sends every search to commercetools. A cached search can list a product for up to this long after it left the result set; its price and content are always current. Ignored with search.

identifierAttributes?IdentifierAttributes

The attributes a variant's EAN, MPN and HS code are read from. Default to attributes named ean, mpn and hscode.

productKinds?ProductKindsConfig

Which product types, or which of their variants, are delivered digitally, keyed by product type key. Every other variant is physical.

stock?StockOptions

How a variant's stock is worded: the threshold under which the quantity left is shown, and whether an out-of-stock variant with a restock date can be pre-ordered.

accessoryAttributes?AccessoryAttributes

The variant attributes the accessories, spare parts, complementary products, bundle extras (sets of product references) and sales unit are read from. Default to accessories, spareParts, complementaryProducts, bundleProducts and salesUnit.

lowestPriceField?string

The Money custom field on a price that holds the lowest price of the 30 days before its discount, as EU price-indication rules require beside a reduction. Set by whatever sets the discount. Defaults to lowestPrice.

minimumQuantityAttribute?string

The variant attributes holding a minimum order quantity, a maximum per line and a pack size, for ProductVariant.quantityRule. Give them the names CartModule is given, so the stepper allows what the cart accepts. Without any of them, quantityRule is null.

maximumQuantityAttribute?string
packSizeAttribute?string
IdentifierAttributes3The fields of identifierAttributes.
FieldTypeDescription
ean?string
mpn?string
hscode?string

Extends AbstractModule<CommercetoolsLoaderContext>.

The same module on medusa and sfcc.