I'm adding a custom UiComponent to checkout using Layout Processor:
- LayoutProcessor.php
$this->jsLayout['components']['checkout']['children']['sidebar']
['children']['summary']['children'] = [
'my-item' => [
'displayArea' => 'my-item',
'component' => 'Vendor_Module/js/view/my-item',
'config' => [
'template' => 'Vendor_Module/my-item'
],
'custom-data' => 'some custom data'
];
- Vendor_Module/js/view/my-item.js
define(
[
'jquery',
'ko',
'uiComponent',
'Magento_Checkout/js/model/totals'
],
function ($, ko, Component, totals) {
'use strict';
return Component.extend({
items: ko.observable([]),
initialize: function () {
this._super();
totals.getItems().subscribe(function (items) {
this.setItems(items);
}.bind(this));
},
getItemsToRender: function () {
`I want my custom data here`
}
});
}
);
Is it possible to "send" custom data from LayoutProcessor to js component?