Widgets

Magento provides support for widgets. Though the word "widget" might imply frontend development skills and activities, we will look at them as a part of the backend development flow because creating useful and robust widgets requires a significant amount of backend knowledge.

Magento provides several out-of-the-box widgets; some of them are as follows:

  • CMS page link
  • CMS static block
  • Catalog category link
  • Catalog new products list
  • Catalog product link
  • Catalog products list
  • Orders and returns
  • Recently compared products
  • Recently viewed products

To create a fully custom widget, we start by defining app/code/Foggyline/Office/etc/widget.xml with content, as follows:

<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module: ...

Get Magento 2 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.