Magento 2 widgets allow you to display the static or dynamic content in CMS blocks or pages. It could be anything from catalog product lists to recently viewed products.
Magento provides widget functionality by default. However, it can't have it all. So, sometimes you implement your own widgets.
In this article, you're going to learn more about one of them — Magento 2 Product Widget and how you can customize it.
Unlike other product list widgets in Magento, Product Widget Advanced allows you to add single products to your store pages. It contains all necessary information customers might need to follow: images, price, descriptions, reviews.
However, sometimes you might need to customize it as per your needs.
To customize product widget in Magento 2:
- Copy the app/code/Magefan/ProductWidget/view/frontend/templates/default.phtml file from the extension folder and save it under cutom-template1.phtml name.
- Add the necessary changes by customizing the code in the file and save the file.
- Upload it to your server as app/design/frontend/ThemeVendor/mythemename/Magefan_ProductWidget/templates/cutom-template1.phtml.
- In the widget options, define the field Custom Template as "Magefan_ProductWidget::cutom-template1.phtml"
Once you add product block to WYSIWYG editor or directly via widget, don't forget to check the changes on the storefront.
Explore the Magento 2 Product Widget extension on our live demo and find out more about the options it offers you.