2

i want to rewrite checkout success.phtml file in my moudule currently success.phtml file coming from my theme folder like

app/design/frontend/mytheme/Magento_Checkout/templates/success.phtml

now i want this file in my module i done this but not wroking for me

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="checkout.success">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Mymodule_Module::success.phtml</argument>
        </action>
    </referenceBlock>
</page>
1

3 Answers 3

1

Create the file

app/code/Mymodule/Module/view/frontend/layout/checkout_onepage_success.xml

and add the following:

<?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>
        <referenceBlock name="checkout.success" template="Mymodule_Module::checkout/success.phtml"/>
    </body>
</page>
3
  • not working i treid but still file coming same folder
    – 3434
    Commented Feb 26, 2019 at 6:37
  • hmmm then i make change in theme file
    – 3434
    Commented Feb 26, 2019 at 6:38
  • you can Magento_Checkout layout file removed it and Please don't forget to clear cache after change in layout xml files Commented Feb 26, 2019 at 6:41
1

If you need override success page in theme, Create layout file:

app/design/frontend/VendorName/ThemeName/Magento_Checkout/view/frontend/layout/checkout_onepage_success.xml

With 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>
        <referenceBlock name="checkout.success" template="Magento_Checkout::checkout/custom-success.phtml"/>
    </body>
</page>

And create template in your theme:

app/design/frontend/VendorName/ThemeName/Magento_Checkout/view/frontend/checkout/custom-success.phtml
0

create template in your theme:

app/design/frontend/VendorName/ThemeName/Magento_Checkout/templates/custom-success.phtml

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.