I need to add a div inside the summary section. please guide me how to achieve the expected result. Also please check with below image to view summary section.
Thanks
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI need to add a div inside the summary section. please guide me how to achieve the expected result. Also please check with below image to view summary section.
Thanks
You can override the checkout_cart_index page:
1.Inside [vendor-name] / [module-name] / view / frontend / layout / checkout_cart_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.totals">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="block-totals" xsi:type="array">
<item name="children" xsi:type="array">
<item name="CustomData" xsi:type="array">
<item name="component" xsi:type="string">[vendor-name_module-name]/js/checkout/cart/totals/customdata</item>
<item name="sortOrder" xsi:type="string">20</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">[vendor-name_module-name]/checkout/cart/totals/customdata</item>
<item name="title" xsi:type="string" translate="true">Custom Data</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
2.Create a js file under [vendor-name_module-name] / view / frontend / web / js / checkout / cart / totals / customdata.js with
define([ 'uiComponent' ], function (Component){ 'use strict'; return Component.extend({}); });
3.Create a html file under [vendor-name_module-name] / view / frontend / web / template / checkout / cart / totals / customdata.html
<tr class="totals">
<th class="mark" scope="row">
<div>This is a div element</div>
</th>
</tr>
The Result will be
Hope this will be help you
Please try with below url -
Add custom product attribute to checkout summary Magento 2
If you want to add label or message than override below html file checkout\view\frontend\web\template\summary\item\details.html
I hope its work for you.