Skip to Content

Recent Products

About

Recent Products — is a html/js component that shows recently viewed products. Unlike default products lists, this block is rendered on client side using local storage data.

Source Code:

Add custom data

When adding custom data to the Recent products block in Luma-based theme you have to create Column uiComponent. It may look like this:

define(['Magento_Ui/js/grid/columns/column'], function (Column) {
   'use strict';

   return Column.extend({
       getValue: function (row) {
           return row.extension_attributes.custom_attribute;
       }
   });
});

The code above will not work in Breeze Frontend. Here is a Breeze-compatible alternative:

(function () {
    'use strict';

    $.mixin('recentProducts', {
        getAdditionalContent: function (original, row, element) {
            return row.extension_attributes.custom_attribute + original(row, element);
        }
    });
})();

You can put this code into your custom.js file.