In Magento_2_Installation/vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html
, data-bindings (via the knockout js files) places the name
and qty
of the item to be displayed in the Sidebar Summary.
How would I also pull in the size
of the item to be displayed along with the name
and qty
using data-binding?
For reference, I've included the file: Magento_2_Installation/vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html
<div class="product-item-inner">
<div class="product-item-name-block">
<strong class="product-item-name" data-bind="text: $parent.name"></strong>
<div class="details-qty">
<span class="label"><!-- ko i18n: 'Qty' --><!-- /ko --></span>
<span class="value" data-bind="text: $parent.qty"></span>
</div>
</div>
<!-- ko foreach: getRegion('after_details') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<!-- ko if: (JSON.parse($parent.options).length > 0)-->
<div class="product options" data-bind="mageInit: {'collapsible':{'openedState': 'active'}}">
<span data-role="title" class="toggle"><!-- ko i18n: 'View Details' --><!-- /ko --></span>
<div data-role="content" class="content">
<strong class="subtitle"><!-- ko i18n: 'Options Details' --><!-- /ko --></strong>
<dl class="item-options">
<!--ko foreach: JSON.parse($parent.options)-->
<dt class="label" data-bind="text: label"></dt>
<!-- ko if: ($data.full_view)-->
<dd class="values" data-bind="html: full_view"></dd>
<!-- /ko -->
<!-- ko ifnot: ($data.full_view)-->
<dd class="values" data-bind="html: value"></dd>
<!-- /ko -->
<!-- /ko -->
</dl>
</div>
</div>
<!-- /ko -->
Best Answer
You will have to create a plugin for that. I wanted to add product flavor to order summary. This is the way I created a plugin and achieved what I wanted.
Vendor = Sejal
Files you need to create:
app\code\Sejal\Flavor\registration.php
app\code\Sejal\Flavor\etc\di.xml
app\code\Sejal\Flavor\etc\module.xml
app\code\Sejal\Flavor\Plugin\ConfigProviderPlugin.php
vendor\magento\module-checkout\view\frontend\web\template\summary\item\details.html
you can override this file in your theme like this
app\design\frontend\Vendor\themename\Magento_Checkout\web\template\summary\item\details.html
Code:
registration.php
di.xml
module.xml
ConfigProviderPlugin.php
details.html
Copy
vendor\magento\module-checkout\view\frontend\web\template\summary\item\details.html
in theme and addbelow
However the flavor is displayed only on checkout shipping information page not on payment page.