How to create Random Products block?

Today is another beautiful day to learn about the various way of creating notable recommendation product block inside Magento 2. Have not been overcome idea block recently, when you can’t figure out exactly what you want, what your business wants or what precise your customers want? You have no idea about what will you promote? Then just pick up a random one in your storage and suggest it to them. As a matter of fact, sometimes people still end up buying merchandises which are not in their primary wishlist at the first place.

What does Random Products block?

Block is a kind of the solid slider can be inserted in your website. Sliders can be used for all kind of websites however they’re most commonly used on business websites or professional portfolio websites. Therefore, it’s a practical matter that the number of digital stores who are experiencing how to promote dozen of products on a page, is increasing greatly day by day.

And Random Products block will collect limited products randomly, display it on the slider. Each of block will switch products in your catalog differently so no worries about duplicate product galleries.

Does it work on my site?

If you can consider use block generated by Magento 2 Auto Related Products extension, trademark by Mageplaza, obviously you won’t have to concern about the compatibility. Mageplaza builds the extension hinge on Magento 2 standard code hence customized block won’t cause conflicts to your store nor increase loading time.

Give a quick glance at Magento 2 Auto Related Products extension

Benefits Random Products block

In-bulk promotion

Particularly, Random Products display different products in each of pages, so instead of manually configuring products per thousand of item detail pages in pain, you can let a module generate them automatically based on a fixed rule.

Boosting sales effectively

Thanks to the mentioned in-bulk promotion in the above passage, you’ll be able to implement your marketing campaign now by scattering and pushing up all your brands equally in a short of time.

If you are a newbie with a fresh-born store in Magento 2, this advance block is definitely a good suggestion for you to consider. There will be an extra section that will help you compare the number of clicks and research which products are best stirring up visitor’s curiosity, the first brick to build more product strategies from customer’s behaviors.

How to configure Random Products block

Installing Automatic Related Products extension is the most important part. There are 3 ways to execute this plugin and all of them are easy to configure. They’re all supplied by the reasonable pricing that it’s worth for your finance.

And here’s the detailed installation guide for Automatic Related Product extension in this link.

2. Install a New Product block

In this particular example, I’ll try to display a Random Products block which is placed at any product page relates to Bras&Tanks

Step 1: Create a new rule

You have to set a new rule to specify when this block is allowed to be displayed. To create a new Rule on Product Page, go to Mageplaza > Automatic Related Products > Manage Rules. In the Add Rule section, select Product Page.

A new Related Block Rule form will appear.

Step 2: Set Rule Information

ARP6 In the Rule Information form:

  • Rule Name field is where you name the rule in the backend only. Here I’ll name it as “Bras & Tanks [Random]”
  • Location is where you specify the block where it located. I’ll choose it as “Replace native related products” so that the new block will replace the Magento’s default Related Product Block
  • In the Status field: choose “Active” to enable the rule.
  • In the Store View field you can select the store view where the rule applies on.
  • In the Customer Group field: The rule is only applicable to customers who in the selected group.
  • In the From and To if you want to set the block in a period of time only, feel free to config this section.
  • In the Priority field: This is the field where you enter the priority of the rule. I’ll enter 1 in this field.
Step 3: Set Rule’s Condition
  • Applying “Style General contains Bra and Tank”. If you want another rule or even different one, play with it


After saving the conditions, you’ll get a Product List. Click on Preview Product to display the products that meet the conditions.

Step 4: Set Rule’s Action


  • The Block name field is where you can name the block which is displayed in the frontend. I name it as “Random Matches”
  • In the Product Layout field: I choose “Slider” for its layout.
  • In the Limit number of products field: Enter the maximum number of products displayed in a block. At this field, I set 15.
  • In the Display “Out-of-stock” products field: select “No” to not display Out-of-Stock products in my Bestseller slider. It’s not a good impression if your customers see unavailable items being featured.
  • In the Product order field: choose how to sort products in the block. Of course, I’ll choose “Random”
  • In the Display additional information field: choose additional information or/and buttons displayed under products in the block, including Price, Review Information, Add to Cart buttons.
Step 5: Check result

Don’t forget to click Save Config. Now I’m coming back to the frontend and see my hard work’s result


It’s done successfully!

Please take a quick glance the official page of the Automatic Related Products extension to discover more notable features! Magento 2 Auto Related Products

Comments for How to create Random Products block?