Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

How to Display Order ID on Your Checkout Success Page?

Author: Viha Digital Commerce
by Viha Digital Commerce
Posted: Jan 19, 2019

It is important to use the checkout success page effectively for the customers. You can use tricks that help your customers to remain on the page so that you get the opportunity to increase your sales.

You can easily obtain order ID with the help of existing code

Now load order with the help of this particular order ID and fetch the data required

You can also get other details along with order ID using the code mentioned below

How to fetch order details from your order ID

The code snippet mentioned below will help you obtain order details like order items, customer billing, payment and shipping details via order id.

Note: For demonstration purpose Objectmanager.Codexblog is being used which is otherwise is not recommended for direct use. You should use a particular constructor method direct an object.

Fetch information for order items

Fetch order payment details

Fetch order customer details

Fetch order shipping & billing details

How to show order details on success page after the order is placed

Create the file app/code/Vendor/Module/etc/di.xml and add the following:

Create the file app/code/Vendor/Module/Block/Success.php and add the following:

Create the file app/code/Vendor/Module/view/frontend/templates/checkout/success.phtml and add the following:

About the Author

Viha Digital Commerce is a full-service ECommerce & CMS Web Development Agency(Over 8+ years of excellence with 1800+ projects) that provides value-added services at affordable rates for Magento, PrestaShop, Shopify & WordPress development.

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: Viha Digital Commerce

Viha Digital Commerce

Member since: Feb 22, 2018
Published articles: 23

Related Articles