Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DEV

Display custom block on the checkout cart page in Magento 2

Hello Friends!

In Magento 2, sometimes we need to save additional information in quotes or we want to display some information on the cart page on the frontend. So, we can achieve the same by following steps:

1. Create checkout_cart_index.xml file inside the app/code/Vendor/CustomModule/view/frontend/layout/ directory.

<?xml version="1.0"?>
<!-- /**
 * Vendor Desc.
 *
 * @category Vendor
 * @package Vendor_CustomModule
 * @author Vendor
 * @copyright Copyright (c) Vendor
 * @license https://example.com/license.html
 */ -->
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="checkout.cart.order.actions">
            <block class="Magento\Framework\View\Element\Template" 
                name="checkout.cart.customblock" 
                template="Vendor_CustomModule::customblock.phtml">
            </block>
        </referenceContainer>
    </body>
 </page>

2. Create the customblock.phtml file inside the app/code/Vendor/CustomModule/view/frontend/templates/ directory.

<p style="color:green;">
    Custom Block<br/>
    Write your content Here...OR Create a Form
</p>

3. Look at the result in the following image.

cartCustomBlock
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home