How to Add Custom Block in Checkout Success Page in Magento 2

The importance of optimizing the “Thank You” page in E-commerce can’t be stressed enough. It is the best option to nurture the leads and get the most out of the customers who have once trusted you with their money!

Neil Patel shares how to increase ROI on the thank you page. However, for Magento 2 store owners, it is not going to be easy with the default success page after checkout.

Hence, I have come up with a solution that can be useful to optimize the thank you page in Magento 2 store. The below programmatic method is to add custom block in checkout success page in Magento 2.

The method can be used to add social media buttons, newsletter subscription buttons, coupon code blocks, more product suggestions, etc.

Get as much creative as you can and optimize the Magento 2 checkout success page to boost the conversion, improve the customer experience, and benefit the business!

Method to Add Custom Block in Checkout Success Page in Magento 2:

  1. Create registration.php file in app\code\[Vendor]\[Namespace]\
  2. Create module.xml file in app\code\[Vendor]\[Namespace]\etc
  3. Create checkout_onepage_success.xml file in app\code\[Vendor]\[Namespace]\view\frontend\layout
  4. Create success.phtml in app\code\[Vendor]\[Namespace]\view\frontend\templates\order\

That’s it.

Any doubts in the implementation? Please mention them in the Comments section below and I’d be glad to help you out.

Feel free to share the above solution with fellow developers on social media.

Thanks!
CTA_M2-Success-Page

5
(based on 13 Reviews)
How to Add Custom Block in Checkout Success Page in Magento 2

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

5 Comments

  • Buhle

    Hi there, im quite new to Magento – I’m trying to add Facebook Pixel to a Magento site.

    Which i did by adding the standard pixel code to the head section under the configuration settings with a standard event. Im now trying to track the event purchase but only in the Cart page once the transaction is ‘successful’.

    I’ve read that i would have to add the following:
    fbq(‘track’, ‘Purchase’, {
    value: 0.01,
    currency: ‘ZAR’
    });

    to the success.phtml file. Is this correct? How do i even check that it is working without having to reach the ‘success’ event?

  • Ammar

    I do this but success page does not appear

    • Sanjay Jethva

      Hello,
      If it is redirecting to the order success page once an order is placed, then it will work otherwise you need to check the reference of the theme that is currently in use.
      Have you removed or moved reference?
      Thank You.

  • Syed Muneeb Ul Hasan

    Without any doubt, thank you page plays a very vital role in increasing ROI of any online business.

    Thank you for sharing this useful tutorial!

Leave a Reply

Your email address will not be published. Required fields are marked *