How to get Woo-commerce order details

Since Woocommerce mega major Update 3.0+ things have changed quite a lot:

Also see: Get Order items and WC_Order_Item_Product in Woocommerce 3

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.

Using some WC_Order and WC_Abstract_Order methods (example):

[/crayon]
Get and access to the order data properties (in an array of values):

[/crayon]
Get the order items and access the data with  WC_Order_Item_Product and  WC_Order_Item methods:

[/crayon]

So using  get_data() method allow us to access to the protected data (associative array mode) …

Add a Comment

Your email address will not be published. Required fields are marked *