Customizing the algorithm for recommended products

Version: 10.3

The New Order Placed marketing automation campaign provides you with the ability to send a follow-up email message to customers who have recently made a purchase. To attract customers back to your storefront, this follow-up email message recommends products that they might like. By default, the list of recommended products is based on the latest customer purchase involving:

  • The order ID from the last order placed.

  • The related product relationships defined in the catalog. By default, four relationships are defined in the catalog but you can add more relationships as required.

  • A recommended products algorithm implemented as a  provider that reads the products defined by the relationship field of the purchased products and selects a given number of products.

Note

The algorithm for recommended products is not based on machine learning. It uses instead the relationships configured in the catalog.

The default provider is based on the order placed and, by default, the algorithm in the Recommended Products provider does the following:

  • Retrieves the order based on the order ID.

  • Processes the order lines in order.

  • Selects the recommended products from the related products relationships for each line in a round-robin fashion until the maxNumberOfProducts parameter (defined on the data source for the Email recommended products rendering) is reached.

    For example, if the order contains five products and each product has five related products (for a total of 25 products) then:

    • Line A has related products A1-A5

    • Line B  has related products B1-B5

    • Line C  has related products C1-C5

    • Line D has related products D1-D5

    • Line E has related products E1-E5

    If the maxNumberOfProducts parameter is set to 10, the recommended products lists includes product IDs for A1, B1, C1, D1, E1, A2, B2, C2, D2, and E2.

You can override the default recommended products provider containing the algorithm and retrieve a different list of recommended products based on the order by providing an implementation for the Sitecore.Commerce.XA.Foundation.Catalog.Providers.IRecommendedProductsProvider interface.

This interface requires an implementation for the GetRecommendedProductsIds method that returns the recommended product item IDs:

RequestResponse
IEnumerable<ID> GetRecommendedProductsListIds(BaseRecommendedProductsProviderOptions recommendedProductOptions);

Where BaseRecommendedProductsProviderOptions contains:

  • ProviderMainKey, which is the order ID or product ID.

  • MaxNumberofProducts, which is the number of recommended products to return.

Note

Because the only parameter that is an extensible object is BaseRecommendedProductsProviderOptions, you can customize the actual number and type of parameters you pass into the provider by customizing the object. The provider is instantiated using IoC and is configured in the Sitecore.Commerce.XA.Foundation.Catalog.config file.

Do you have some feedback for us?

If you have suggestions for improving this article,