I am using woo-commerce and trying to get all the order details from database.I am new to it and cant make it happened.I have already created order_details.php
template where I can get all orders data.
Can anyone help me out?
I am using woo-commerce and trying to get all the order details from database.I am new to it and cant make it happened.I have already created order_details.php
template where I can get all orders data.
Can anyone help me out?
Comments are closed.
Try This Code.
Customize As par Ur Requerment.
Since Woocommerce mega major Update 3.0+ things have changed quite a lot:
There is some New classes for Order items:
WC_Order_Item class.
WC_Order_Item_Product class.
So also the Order items properties will not be accessible as before in a foreach loop and you will have to use this specific getter and setter methods instead
Get and access to the order data properties (in an array of values):
Get the order items and access the data with WC_Order_Item_Product and WC_Order_Item methods:
$my_course_query = new WP_Query(array('post_type'=>'shop_order','post_status'=>'wc-completed'));
Change status to woocoommerce status
You can user below code
You need to include
wp-load.php
fileand add global variable as
global $wpdb;
before this code.