2

In my custom payment module, a checkout_index_index.xml file allows me to display a custom block above the payment options if I add the following xml code:

<referenceContainer name="content">
  <block class="Namespace\MyModule\Block\MyBlockClass" before="-" template="Namespace_MyModule::checkout/cart/my-form.phtml"/>
</referenceContainer>

On that /checkout/#payment page, what I should replace name="content" with in the referencecontainer tag so that my block is displayed in the sidebar on the right, either in the Order Summary block or under ?

0

The sidebar on /checkout/#payment cannot be modified via xml.

The only way in the use case presented above is to override the core sidebar.html template with another one located in the custom module.

So in order to add a custom block on the right sidebar on the checkout payment page follow the steps below:

1- Create a requirejs-config.js in your custom module.

For example, at MyModule/view/frontend/requirejs-config.js

In the requirejs-config.js file, put the following declaration:

var config = {
"map": {
    "*": {
      "Magento_Checkout/template/sidebar.html": "Namespace_MyModule/template/sidebar.html"
    }
}

};

This is telling Magento to replace the default core sidebar.html with the one available in the custom module.

2- Customise your sidebar.html

Copy the core Magento_Checkout/template/sidebar.html file and paste it in your custom module as specified in the requirejs-config.js, at Namespace_MyModule/template/sidebar.html

Source and more informations: https://community.magento.com/t5/Programming-Questions/Custom-block-under-Order-Summary-block/m-p/66983#M2163

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.