By default, Magento 2 displays a standard thank you message on the order success page.
However, many store owners would like to add additional content to enhance the customer experience or deliver important post-purchase information.
This can be achieved by adding a custom block to the order success page in Magento 2.
Common Custom Block Examples
Here are some commonly used custom block used:
| Custom Blocks | Examples |
| Personalized thank you custom block | Thank you for your order. We appreciate your support of our business. |
| Promo code for their next purchase | Use code MITHANKYOU to get 10% off your next order. |
| Post-purchase or delivery instructions | Your purchase includes one year of support. |
| Customer feedback or reviews block | How would you rate your experience with Meetanshi? |
These are just a few examples. A custom block on the success page opens up many possibilities for improving customer engagement and retention
How to Implement a Custom Block in Your Magento 2 Store?
To add a custom block, follow the steps below:
Step 1: Create the layout XML file
Start with creating a layout XML file:
app/code/Vendor/Extension/view/frontend/layout/checkout_onepage_success.xml
<?xml version="1.0"?>
<body>
<referenceContainer name="order.success.additional.info">
<block class="Magento\Framework\View\Element\Template"
name="custom.order.success"
template="Vendor_Extension::success.phtml"
after="-">
</block>
</referenceContainer>
</body>
Step 2: Create the Corresponding Template File
Then, create a corresponding template file:
app/code/Vendor/Extension/view/frontend/templates/success.phtml
<p>Content of your custom block</p>
You can now add your desired HTML or dynamic PHP content in the success.phtml file.
This approach offers a flexible and clean way to extend the order success page functionality in Magento 2 without affecting the core files.
Refer to our Magento 2 success Page extension to easily customize the order success page through admin settings. Enhance customer experience, boost retention, and drive repeat sales with flexible design and promotional options.