I create a custom checkout block for checkout success page, but unfortunately the data printed twice, First in the right div inside body, and the other printed after the footer, here is the checkout_onepage_success.xml:

<?xml version="1.0"?>
    <referenceContainer name="order.success.additional.info">
        <block class="Namespace\Module\Block\Success"
  • have you define block inside footer order.success.additional.info at any place? Commented Feb 22, 2017 at 5:06
  • @RakeshJesadiya nope
    – simple guy
    Commented Feb 22, 2017 at 5:13

2 Answers 2


You need to rewrite success block as below

create di.xml file at Namespace\Module\etc\di.xml

<?xml version="1.0"?>    
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Checkout\Block\Onepage\Success" type="Namespace\Module\Block\Success" />

Create your block file Success.php at Namespace\Module\Block\Success.php

Add below code to it.


namespace Namespace\Module\Block;

class Success extends \Magento\Checkout\Block\Onepage\Success
     * add your code here


Now add layout file checkout_onepage_success.xml at Namespace\Module\view\frontend\layout\checkout_onepage_success.xml

add below code to it

<?xml version="1.0"?>
    <referenceBlock name="checkout.success">
       <action method='setTemplate'>
          <argument name='template' xsi:type='string'>Namespace_Module::order/success.phtml</argument>

The problem you are encountering is a bug in Magento 2: https://github.com/magento/magento2/issues/4999

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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