I want to add custom link in order summary on checkout page in magento. I have tried several options but doesn't work.
Is there any solution for this.
checkoutmagento2
I want to add custom link in order summary on checkout page in magento. I have tried several options but doesn't work.
Is there any solution for this.
You can display the order total and also remove the products list by adding checkout_index_index.xml
to your module/theme with this content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Cart Subtotal</item>
</item>
</item>
<item name="cart_items" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
You can display sidebar block just before Shipping Address.
Add below code to
app/design/frontend/Vendor/YourTheme/Magento_Checkout/layout/checkout_index_index.xml
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary</item>
<!--<item name="displayArea" xsi:type="string">summary</item>-->
<item name="sortOrder" xsi:type="string">0</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/summary</item>
</item>
<item name="children" xsi:type="array">
<item name="totals" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/totals</item>
<item name="displayArea" xsi:type="string">totals</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/summary/totals</item>
</item>
<item name="children" xsi:type="array">
<!-- sort order for this totals is configured on admin panel-->
<!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Cart Subtotal</item>
</item>
</item>
<item name="shipping" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/shipping</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Shipping</item>
<item name="notCalculatedMessage" xsi:type="string" translate="true">Not yet calculated</item>
</item>
</item>
<item name="grand-total" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Order Total</item>
</item>
</item>
</item>
</item>
<item name="itemsBefore" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge your components here -->
</item>
</item>
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
</item>
</item>
</item>
</item>
<item name="itemsAfter" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge your components here -->
</item>
</item>
</item>
</item>
</item>
</item>
<item name="sidebar" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
Apply and check it from your end.
Best Answer
Question is too old but i am providing solution here so if someone have encountered this issue / requirement.
To add Edit link on cart summary block, you have to make changes in web/template/summary/cart-items.html file of Magento_Checkout :
Copy
module-checkout/view/frontend/web/template/summary/cart-items.html
and paste this in your Theme'sMagento_Ccheckout/view/frontend/web/template/summary/cart-items.html
.And add below code block :
Where you want to add Cart summary link.
After making changes delete your var/view_processed/pub and pub/static/frontend folders and deploy static-content again.
NOTE : if you add this block within
data-role=title
div it will add the link but will not work as click event will not work on URL , because click event is being used for cart summary accordion ( open close ). solution is tested with Magento 2.2.2.