How Magento 2 get Order Data on Success Page?

Written by Chirag Parmar

May 31, 2021

How Magento 2 get Order Data on Success Page?

By default, Magento show thank you message and quick order id on the order success page. Some customers have custom requirements for edit success page content and show order information in detail or pass this data to google analytics. In this blog, I will show you how to get order information on the success page and use order data for various prospects.

There are 2 ways to get Order Detail in Success page :

We can get order data on the Magento 2 success page by following way :

  • 1) By overriding success block
  • 2) By Object Manager (Not Recommended)

1)  Register your module at Path :- Dolphin/Ordersuccess/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Dolphin_Ordersuccess',
    __DIR__
);

2) Create module.xml file at  Path:- Dolphin/InvoicePdf/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Dolphin_Ordersuccess" setup_version="0.0.1" />
</config>

Chirag Parmar

Author

We can help you with

  • Dedicated Team
  • Setup Extended Team
  • Product Development
  • Custom App Development

Schedule a Developer Interview And Get 7 Days Risk-Free Trial

Fill out This Form and one of Our Technical Experts will Contact you Within 12 Hours.

    Google
    |

    4.8

    Google
    |

    4.8

    Google
    |

    4.9

    Google
    |

    4.8

    Google
    |

    4.9

    Copyright © 2024 DOLPHIN WEB SOLUTION. All rights reserved.

    TO TOP