SlideShare a Scribd company logo
How to Get WooCommerce Order Details?
As we know that, WooCommerce is the most popular platform for eCommerce
solutions, and it already has by default templates of each page with the default
template design.
So, sometimes we want to change the design of the template with our custom
template and in that template, we need order details to show as per custom
design.
Let’s get started.
Get WooCommerce Order Details
We have to send in the custom email body content. So there, we have to use the
WC_Order object to get WooCommerce order details.
We can also use the wc_get_orders(), this is function to get the order object and
get the order details on certain parameter.
RECENT POSTS
CATEGORIES
MOST VIEWED POSTS
FOLLOW US
Stay updated via social channels
HOW TO WOOCOMMERCE WORDPRESS
Blog Categories  Tips & Tricks Contact

HOME WOOCOMMERCE HOW TO GET WOOCOMMERCE ORDER DETAILS?
AMAN MEHRA FEBRUARY 27, 2021 LEAVE A COMMENT
Tweet on Twitter Share on Facebook
How to Add WooCommerce Cart
Icon in Menu with Item Count?
How to Secure Password Using
bcrypt in PHP?
How to Make a DataTable in
ReactJS?
How to Inline Style in ReactJS?
How to Install WordPress Theme
(2021 Edition)?
How To
PHP
ReactJS
Tips & Tricks
WooCommerce
WordPress
WooCommerce Remove
Update Cart Button and
Make it Automatically
Update.
October 5, 2020
How to Change Price of
Speci c Product and
Quantity in Cart?
October 14, 2020
How to Redirect to
Checkout After Add to
Cart?
October 16, 2020
How can I Prevent SQL
Injection in PHP?
October 7, 2020
Upload Multiple Featured
Images in a Post OR Page
January 4, 2021
$order_id = 145;
$order = new WC_Order( $order_id );
//$order = wc_get_order( $order_id );
$orderid = $order->get_id(); // Get the order ID
$parent_id = $order->get_parent_id(); // Get the parent
$user_id = $order->get_user_id(); // Get the user ID
$user = $order->get_user(); // Get the WP_User obje
// Get Order Status
$order_status = $order->get_status(); // Get the order
// Get Order Dates
$date_created = $order->get_date_created(); // Get date
$date_modified = $order->get_date_modified(); // Get dat
$date_completed = $order->get_date_completed(); // Get o
$date_paid = $order->get_date_paid(); //Get order paid d
//Get Order Billing Details
$billing_first_name = $order->get_billing_first_name();
$billing_last_name = $order->get_billing_last_name();
$billing_company = $order->get_billing_company();
$billing_address1 = $order->get_billing_address_1();
$billing_address2 = $order->get_billing_address_2();
$billing_city = $order->get_billing_city();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
So, we see how to get WooCoomerce order details with the help of getter
method. You can check more method here.
If you want to get and access the protected data of the order object then, you
can use the get_data() function.
It is the same as we did above with the instance of the $order object. E.g:
$order->get_data()
It will return the data as an associative array and we can use this array with
key=>pair value.
Let’s see the example.
$billing_state = $order->get_billing_state();
$billing_postcode = $order->get_billing_postcode();
$billing_country = $order->get_billing_country();
$billing_email = $order->get_billing_email();
$billing_phone = $order->get_billing_phone();
$billing_formatted_name = $order->get_formatted_billing_
$billing_formatted_address = $order->get_formatted_billi
//Get Order Shipping Details
$shipping_first_name = $order->get_shipping_first_name(
$shipping_last_name = $order->get_shipping_last_name();
$shipping_company = $order->get_shipping_company();
$shipping_address1 = $order->get_shipping_address_1();
$shipping_address2 = $order->get_shipping_address_2();
$shipping_city = $order->get_shipping_city();
$shipping_state = $order->get_shipping_state();
$shipping_postcode = $order->get_shipping_postcode();
$shipping_country = $order->get_shipping_country();
$shipping_formatted_name = $order->get_formatted_shippin
$shipping_formatted_address = $order->get_formatted_ship
//Get Order Payment Details
$currency = $order->get_currency(); // Get the curr
$payment_title = $order->get_payment_method_title(); //
$payment_method = $order->get_payment_method(); // Get t
$fees = $order->get_fees(); // Get the order fees
$subtotal = $order->get_subtotal(); // Get the order sub
$total_tax = $order->get_total_tax(); // Get the order t
$total = $order->get_total(); // Get the order total
$order_id = 145;
$order = wc_get_order( $order_id );
$order_data = $order->get_data(); // Get the Order data
$orderid = $order_data['id']; // Get the order ID
$parent_id = $order_data['parent_id']; // Get the parent
// Get Order Status
$order_status = $order_data['status']; // Get the order
// Get Order Dates
$date_created = $order_data['date_created']; // Get dat
$date_modified = $order_data['date_modified']; // Get da
$date_completed = $order_data['date_completed']; // Get
$date_paid = $order_data['date_paid']; //Get order paid
//Get Order Billing Details
$billing_first_name = $order_data['billing']['first_name
$billing_last_name = $order_data['billing']['last_name'
$billing_company = $order_data['billing']['company'];
$billing_address1 = $order_data['billing']['address_1']
$billing_address2 = $order_data['billing']['address_2']
$billing_city = $order_data['billing']['city'];
$billing_state = $order_data['billing']['state'];
$billing_postcode = $order_data['billing']['postcode'];
$billing_country = $order_data['billing']['country'];
$billing_email = $order_data['billing']['email'];
$billing_phone = $order_data['billing']['phone'];
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
How to Add WooCommerce Cart Icon
in Menu with Item Count?
How to Secure Password Using
bcrypt in PHP?
With the get_data() function you can use order data as a array properties for get
WooCommerce order details.
You can also loop the order items with get_items() function, if you have
multiple items in one order.
See the simple example to understand this.
Here, we loop the order items and get the value with getter method, as we used
in above.
So in this article we work with:
WC_Order
wc_get_order()
get_data()
get_items()
I hope you understand! how to get WooCommerce order details and use it?
YOU MAY ALSO LIKE
GET ORDER DETAILS
 WOOCOMMERCE ORDER
 WOOCOMMERCE ORDER DETAILS

Tweet on Twitter Share on Facebook
//Get Order Shipping Details
$shipping_first_name = $order_data['shipping']['first_na
$shipping_last_name = $order_data['shipping']['last_name
$shipping_company = $order_data['shipping']['company'];
$shipping_address1 = $order_data['shipping']['address_1
$shipping_address2 = $order_data['shipping']['address_2
$shipping_city = $order_data['shipping']['city'];
$shipping_state = $order_data['shipping']['state'];
$shipping_postcode = $order_data['shipping']['postcode'
$shipping_country = $order_data['shipping']['country'];
//Get Order Payment Details
$subtotal = $order_data['subtotal']; // Get the order su
$total_tax = $order_data['total_tax']; // Get the order
$total = $order_data['total']; // Get the order total
foreach ( $order->get_items() as $item_id => $item ) {
$product = $item->get_product();
$product_id = $item->get_product_id();
$variation_id = $item->get_variation_id();
$name = $item->get_name();
$quantity = $item->get_quantity();
$subtotal = $item->get_subtotal();
$total = $item->get_total();
$tax = $item->get_subtotal_tax();
$all_meta = $item->get_meta_data();
$single_meta = $item->get_meta( '_meta_key', true );
$type = $item->get_type();
//and so on...
}
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
How to Make a DataTable in
ReactJS?
How to Inline Style in ReactJS?
How to Install WordPress Theme
(2021 Edition)?
How to Install WordPress –
Beginners Guide?
Name * Email * Website
ABOUT THE AUTHOR: AMAN MEHRA
Hey! I'm Aman Mehra and I'm a full-stack developer and have 5+
years of experience. I love coding and nd solutions to bugs.
LEAVE A REPLY
Your email address will not be published. Required elds are marked *
Comment
Save my name, email, and website in this browser for the next time I comment.
© 2020 Your Blog Coach Privacy Policy Terms and Conditions Sitemap
POST COMMENT
ABOUT
Your Blog Coach is the best site
for nding the solution to any
issue related to coding and learn
more cool stuff and tricks.
QUICK LINKS
Blog
WordPress
WooCommerce
Contact
RECENT POSTS
How to Add WooCommerce Cart
Icon in Menu with Item Count?
How to Secure Password Using
bcrypt in PHP?
How to Make a DataTable in
ReactJS?
JOIN OUR NEWSLETTER
Name
Email
SUBSCRIBE

More Related Content

Recently uploaded

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 

Recently uploaded (20)

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 

Featured

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 

Featured (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

How you can Get WooCommerce Order Details?

  • 1. How to Get WooCommerce Order Details? As we know that, WooCommerce is the most popular platform for eCommerce solutions, and it already has by default templates of each page with the default template design. So, sometimes we want to change the design of the template with our custom template and in that template, we need order details to show as per custom design. Let’s get started. Get WooCommerce Order Details We have to send in the custom email body content. So there, we have to use the WC_Order object to get WooCommerce order details. We can also use the wc_get_orders(), this is function to get the order object and get the order details on certain parameter. RECENT POSTS CATEGORIES MOST VIEWED POSTS FOLLOW US Stay updated via social channels HOW TO WOOCOMMERCE WORDPRESS Blog Categories  Tips & Tricks Contact  HOME WOOCOMMERCE HOW TO GET WOOCOMMERCE ORDER DETAILS? AMAN MEHRA FEBRUARY 27, 2021 LEAVE A COMMENT Tweet on Twitter Share on Facebook How to Add WooCommerce Cart Icon in Menu with Item Count? How to Secure Password Using bcrypt in PHP? How to Make a DataTable in ReactJS? How to Inline Style in ReactJS? How to Install WordPress Theme (2021 Edition)? How To PHP ReactJS Tips & Tricks WooCommerce WordPress WooCommerce Remove Update Cart Button and Make it Automatically Update. October 5, 2020 How to Change Price of Speci c Product and Quantity in Cart? October 14, 2020 How to Redirect to Checkout After Add to Cart? October 16, 2020 How can I Prevent SQL Injection in PHP? October 7, 2020 Upload Multiple Featured Images in a Post OR Page January 4, 2021 $order_id = 145; $order = new WC_Order( $order_id ); //$order = wc_get_order( $order_id ); $orderid = $order->get_id(); // Get the order ID $parent_id = $order->get_parent_id(); // Get the parent $user_id = $order->get_user_id(); // Get the user ID $user = $order->get_user(); // Get the WP_User obje // Get Order Status $order_status = $order->get_status(); // Get the order // Get Order Dates $date_created = $order->get_date_created(); // Get date $date_modified = $order->get_date_modified(); // Get dat $date_completed = $order->get_date_completed(); // Get o $date_paid = $order->get_date_paid(); //Get order paid d //Get Order Billing Details $billing_first_name = $order->get_billing_first_name(); $billing_last_name = $order->get_billing_last_name(); $billing_company = $order->get_billing_company(); $billing_address1 = $order->get_billing_address_1(); $billing_address2 = $order->get_billing_address_2(); $billing_city = $order->get_billing_city(); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  • 2. So, we see how to get WooCoomerce order details with the help of getter method. You can check more method here. If you want to get and access the protected data of the order object then, you can use the get_data() function. It is the same as we did above with the instance of the $order object. E.g: $order->get_data() It will return the data as an associative array and we can use this array with key=>pair value. Let’s see the example. $billing_state = $order->get_billing_state(); $billing_postcode = $order->get_billing_postcode(); $billing_country = $order->get_billing_country(); $billing_email = $order->get_billing_email(); $billing_phone = $order->get_billing_phone(); $billing_formatted_name = $order->get_formatted_billing_ $billing_formatted_address = $order->get_formatted_billi //Get Order Shipping Details $shipping_first_name = $order->get_shipping_first_name( $shipping_last_name = $order->get_shipping_last_name(); $shipping_company = $order->get_shipping_company(); $shipping_address1 = $order->get_shipping_address_1(); $shipping_address2 = $order->get_shipping_address_2(); $shipping_city = $order->get_shipping_city(); $shipping_state = $order->get_shipping_state(); $shipping_postcode = $order->get_shipping_postcode(); $shipping_country = $order->get_shipping_country(); $shipping_formatted_name = $order->get_formatted_shippin $shipping_formatted_address = $order->get_formatted_ship //Get Order Payment Details $currency = $order->get_currency(); // Get the curr $payment_title = $order->get_payment_method_title(); // $payment_method = $order->get_payment_method(); // Get t $fees = $order->get_fees(); // Get the order fees $subtotal = $order->get_subtotal(); // Get the order sub $total_tax = $order->get_total_tax(); // Get the order t $total = $order->get_total(); // Get the order total $order_id = 145; $order = wc_get_order( $order_id ); $order_data = $order->get_data(); // Get the Order data $orderid = $order_data['id']; // Get the order ID $parent_id = $order_data['parent_id']; // Get the parent // Get Order Status $order_status = $order_data['status']; // Get the order // Get Order Dates $date_created = $order_data['date_created']; // Get dat $date_modified = $order_data['date_modified']; // Get da $date_completed = $order_data['date_completed']; // Get $date_paid = $order_data['date_paid']; //Get order paid //Get Order Billing Details $billing_first_name = $order_data['billing']['first_name $billing_last_name = $order_data['billing']['last_name' $billing_company = $order_data['billing']['company']; $billing_address1 = $order_data['billing']['address_1'] $billing_address2 = $order_data['billing']['address_2'] $billing_city = $order_data['billing']['city']; $billing_state = $order_data['billing']['state']; $billing_postcode = $order_data['billing']['postcode']; $billing_country = $order_data['billing']['country']; $billing_email = $order_data['billing']['email']; $billing_phone = $order_data['billing']['phone']; 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  • 3. How to Add WooCommerce Cart Icon in Menu with Item Count? How to Secure Password Using bcrypt in PHP? With the get_data() function you can use order data as a array properties for get WooCommerce order details. You can also loop the order items with get_items() function, if you have multiple items in one order. See the simple example to understand this. Here, we loop the order items and get the value with getter method, as we used in above. So in this article we work with: WC_Order wc_get_order() get_data() get_items() I hope you understand! how to get WooCommerce order details and use it? YOU MAY ALSO LIKE GET ORDER DETAILS  WOOCOMMERCE ORDER  WOOCOMMERCE ORDER DETAILS  Tweet on Twitter Share on Facebook //Get Order Shipping Details $shipping_first_name = $order_data['shipping']['first_na $shipping_last_name = $order_data['shipping']['last_name $shipping_company = $order_data['shipping']['company']; $shipping_address1 = $order_data['shipping']['address_1 $shipping_address2 = $order_data['shipping']['address_2 $shipping_city = $order_data['shipping']['city']; $shipping_state = $order_data['shipping']['state']; $shipping_postcode = $order_data['shipping']['postcode' $shipping_country = $order_data['shipping']['country']; //Get Order Payment Details $subtotal = $order_data['subtotal']; // Get the order su $total_tax = $order_data['total_tax']; // Get the order $total = $order_data['total']; // Get the order total foreach ( $order->get_items() as $item_id => $item ) { $product = $item->get_product(); $product_id = $item->get_product_id(); $variation_id = $item->get_variation_id(); $name = $item->get_name(); $quantity = $item->get_quantity(); $subtotal = $item->get_subtotal(); $total = $item->get_total(); $tax = $item->get_subtotal_tax(); $all_meta = $item->get_meta_data(); $single_meta = $item->get_meta( '_meta_key', true ); $type = $item->get_type(); //and so on... } 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  • 4. How to Make a DataTable in ReactJS? How to Inline Style in ReactJS? How to Install WordPress Theme (2021 Edition)? How to Install WordPress – Beginners Guide? Name * Email * Website ABOUT THE AUTHOR: AMAN MEHRA Hey! I'm Aman Mehra and I'm a full-stack developer and have 5+ years of experience. I love coding and nd solutions to bugs. LEAVE A REPLY Your email address will not be published. Required elds are marked * Comment Save my name, email, and website in this browser for the next time I comment. © 2020 Your Blog Coach Privacy Policy Terms and Conditions Sitemap POST COMMENT ABOUT Your Blog Coach is the best site for nding the solution to any issue related to coding and learn more cool stuff and tricks. QUICK LINKS Blog WordPress WooCommerce Contact RECENT POSTS How to Add WooCommerce Cart Icon in Menu with Item Count? How to Secure Password Using bcrypt in PHP? How to Make a DataTable in ReactJS? JOIN OUR NEWSLETTER Name Email SUBSCRIBE