Magento released a module that uses machine learning to recommend products to potential customers. The goal is that you are able to display targeted and relevant products to visitors exactly when they need it. As customers see products that interest them, they are more likely to make a purchase or add an extra item to the cart.

Lists of cross-sells (cart page), related products (product page) and up-sells (product-page) are some of the most underutilized features in any ecommerce platform because they take time to build and maintain. Unless a 3rd-party module is utilized, these lists are built manually. In Magento Commerce, you can create rules to associate products, but these rules are not smart so you have little control over the exact products display—thus, many revert back to manually-built lists.

Here is the definitive guide to getting this module going on your website.

#0: requirements

Yes, you need to be using Magento Commerce. Grrr (I know). You will know if you are using Commerce as you will see an invoice every year with at least one comma in the total due. Or, you can go to your site and append /magento_version to it and that will tell you if you are using Commerce: example here.

#1: Install via Composer

Difficulty alert: while this is not that difficult, hopefully you have a developer that can run these actions for you in a staging environment before pushing to production.

First, you (or a developer) will need to install the Product Recommendations module:

composer require magento/product-recommendations
bin/magento module:enable --all
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy

Note that you can first run bin/magento module:status to see which modules are disabled and enable each.

Subsequent steps will need to happen both on staging (your test environment) and on production.

See also:

#2: Get your API keys

Now, go to and login. Next, go here. You will, at least, need a production API key. While you are at it, why not also create the sandbox key too? To create the sandbox key, change the Environment drop-down list.

Save both of those keys as you will be adding those into your Magento website shortly.

#3: Configure Magento

We are making great progress! I promise that there’s nothing too difficult in the pipeline.

The next step is to log into your Magento admin, click Stores > Configuration. Navigate to Services > Magento Services.

Paste in your Production Api Key and Sandbox Api Key Values. Click Save.

Once saved, you will be able to create a Saas Project and configure the environment. Just enter details into these fields and click Save Config. The SaaS Environment should look something like this:

You should rarely, if ever, have to touch these settings again.

Here are some errors that I ran into:

  • Invalid API Key: you must have a Production Api Key set. If you only have a sandbox value—no good, my friend.
  • White screen of death: my testing area was running PHP 7.2. While PHP 7.2 is supported by Magento Commerce, a clever developer snuck in a method (array_key_first) that caused Store Configuration to go kaput.

#4: Create Recommendations

Go to Marketing > Product Recommendations for our next task:

Click “New”.

Now, we have some values to configure.

Name your Recommendation.

  • Recommendation name: this is for your own internal purposes / tracking. You could name it “Santa’s toybox”—and no one would be any wiser.
  • Storefront display label: this is what people see. So, you want it to be intuitive. Labels like “Personalized recommendations” or “Here’s some other items we picked for you” would make sense.

Configure your Recommendation.

  • Select page type: you now select on which pages you wish for these recommendations to appear. You have 5 options (Home Page, Category, Product Detail, Cart, Confirmation). Note that these recommendations are not available in a Widget (in Content > Widgets). Magento hardwires specific areas for the recommendations to be placed.
  • Select recommendation type: You have several choices. To bypass the machine-learning elements and get results the quickest, choose “More like this”. Otherwise, you can read about each type here.

Configure the display/placement.

  • Number of products: this selects how many products are displayed in a recommendation viewing area. I suggest 5-7, but the maximum is 20.
  • Select placement: see the placement screenshots below.
  • Choose position: you can drag/drop elements to determine the sort order of similar recommendation rules.

Finally, you can exclude which categories of products you DO NOT want to appear in recommendations. This would be things like custom wholesale products or clearance products.

Click activate.

At the top of Main Content (see red line):

(this is not available for products)

At the bottom of Main Content (see red line):


It wouldn’t be Magento unless something (usually one thing) goes wrong.

Above, I listed several problems that are common with setting up Store Configuration.

Here are a few other things (warning, some developer speak here):

  • Make sure crons are enabled. Cron is something that runs on a regular interval.
  • To trigger a reindex of the data on Magento’s API, first re-index the store then run this SQL query:

    UPDATE catalog_data_exporter_products SET modified_at = '2020-04-01';
    TRUNCATE catalog_data_submitted_hash;
    UPDATE flag SET flag_data = NULL WHERE flag_code = 'products-feed-version';

    This will force Magento to upload everything back into the Magento API.

Now, to you:

How is it going for your implementation? Do you have any questions?

Leave a Reply

Your email address will not be published. Required fields are marked *