How to Add a Custom Block Within Checkout Cart Summary in Magento 2 checkout-summarycustom blockmagento2 How to add a custom block within checkout cart summary in magento 2 Best Answer You need to create this file in your custom module/theme to add custom Block on cart page. app/code/Vendor/Module/view/frontend/layout/checkout_cart_index.xml Content for this file is.. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="checkout.cart.totals.container"> <block class="Magento\Framework\View\Element\Template" name="checkout.cart.custom.block" before="checkout.cart.totals" template="Vendor_Module::custom-block.phtml" /> </referenceContainer> </body> </page> You need to create one template file here in your module or your theme. app/code/Vendor/Module/view/frontend/templates/custom-block.phtml Content for this file.. <?php echo "Custom Block"; ?> Output : Hope this will help you! Related SolutionsMagento 2 Cart – How to Add a Custom Block in Checkout/Cart Page you need to add the class of your block.Try below code <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="checkout.cart.totals.container"> <block class="Miles\FreeShippingCountOnPage\Block\Checkout\Cart\Countdown" name="checkout.cart.miles.countdown" after="-" template="Vendor_Module::checkout/cart/countdown.phtml"/> </referenceContainer> </body> </page> Magento – Magento 2: how to add a block in cart under cart summary We can use Widget: CONTENT > Widgets 1)Mini Cart: In Layout Updates: we can choose Display on > All Pages choose Container > Mini-cart promotion Result: 2)Checkout Cart page: In Layout Updates: we can choose Display on > Specified Page choose Page > Shopping Cart and Container > Cart Summary Container Result: Related TopicMagento 2 – Add Block to Cart SummaryMagento 2 – Add Custom Block Below Cart Summary Page
Best Answer
You need to create this file in your custom module/theme to add custom Block on cart page.
Content for this file is..
You need to create one template file here in your module or your theme.
Content for this file..
Output :
Hope this will help you!