Promoting & showcasing new products are often difficult as part of marketing to attract new customer and bring a sale. There are thousands of ways to let your customer know about newly launched products but showcasing such products on the home page or other landing page lets your customer quickly explore store products. It is extremely beneficial for your potential customers quickly purchase products that save your marketing costs and efforts.
Many time while Magento Custom Development, we came across such requirements where the customer wants to showcase newly launched products or want to features products from a specific category that meets business needs. At that time, we simply create new block inside Magento 2 store and call that block to the .phtml file where we want to display block.
First, we need to call phtml file from static block using this code.

In above code, you pass the category id with this code categories=”1,2,3″.
Now we need to get that category Ids on phtml file like this.

or

That’s it. Simply clear cache and you are done with adding product block in page.
That’s it for today, Let us know if you are facing an issue while implementing this code by commenting below.
Happy Coding!

Click to rate this post!
[Total: 5 Average: 4.2]