please click here for more wordpress cource
How you can get all Properties WooCommerce:
If you want to to get all Woocommerce order properties using function. In this article i will discourse all Properties of Woocommerce order details.
So Using given bellow function you can get all feature of oreder
$order = new WC_Order( $order_id );
Woocommerce Order Details:
If you want to get all order details like user name, user id, products price , order cast , order payment methods , Order currency order status and So
See the given below code :
// Get WC_Order object
// you can get here only order id if donn't the order id use this
$order = wc_get_order( $order_id );
$order_data = $order->get_data(); // The Order data
$order_id = $order_data['id']; //order id
$order_parent_id = $order_data['parent_id']; //order parent id
$order_status = $order_data['status']; // get order status
$order_currency = $order_data['currency']; // order currency get here
$order_version = $order_data['version']; // get order version
$order_payment_method = $order_data['payment_method']; // get payment method
$order_payment_method_title = $order_data['payment_method_title']; // order payment method title
$order_payment_method = $order_data['payment_method'];
$order_payment_method = $order_data['payment_method'];
## Creation and modified WC_DateTime Object date string ##
// Using a formated date ( with php date() function as method)
$order_date_created = $order_data['date_created']->date('Y-m-d H:i:s');
$order_date_modified = $order_data['date_modified']->date('Y-m-d H:i:s');
// Using a timestamp ( with php getTimestamp() function as method)
$order_timestamp_modified = $order_data['date_modified']->getTimestamp();
$order_discount_total = $order_data['discount_total'];
$order_discount_tax = $order_data['discount_tax'];
$order_total = $order_data['total'];
$order_timestamp_created = $order_data['date_created']->getTimestamp();
$order_shipping_total = $order_data['shipping_total'];
$order_shipping_tax = $order_data['shipping_tax'];
$order_total_tax = $order_data['total_tax'];
$order_customer_id = $order_data['customer_id']; // ... and so on
## /// Get BILLING INFORMATION:
$order_billing_company = $order_data['billing']['company'];
$order_billing_first_name = $order_data['billing']['first_name'];
$order_billing_email = $order_data['billing']['email'];
$order_billing_phone = $order_data['billing']['phone'];
$order_billing_last_name = $order_data['billing']['last_name'];
$order_billing_address_1 = $order_data['billing']['address_1'];
## //// Get SHIPPING INFORMATION:
$order_shipping_first_name = $order_data['shipping']['first_name'];
$order_shipping_last_name = $order_data['shipping']['last_name']; //order shipping last name
$order_billing_state = $order_data['billing']['state'];
$order_shipping_company = $order_data['shipping']['company'];
$order_billing_city = $order_data['billing']['city'];
$order_billing_postcode = $order_data['billing']['postcode'];
$order_shipping_address_1 = $order_data['shipping']['address_1'];
$order_shipping_state = $order_data['shipping']['state'];
$order_shipping_postcode = $order_data['shipping']['postcode'];
$order_shipping_address_2 = $order_data['shipping']['address_2'];
$order_billing_address_2 = $order_data['billing']['address_2'];
$order_billing_country = $order_data['billing']['country'];
$order_shipping_country = $order_data['shipping']['country']; // order shipping country
$order_shipping_city = $order_data['shipping']['city'];
// and so one many things you can get woocommerce products
If you have any query feel free to askes me
you can contact with by comment Or contact us form and send me email