When developing WooCommerce plugins or interacting with third-party systems, we often need to retrieve WooCommerce order data. The WooCommerce WC_Order class provides a comprehensive set of methods to access various types of order information. Below is a detailed list of these methods.
If you need to create or update order data, most of the get methods listed below have corresponding set methods, making it very convenient for developers.
Basic Order Data
get_id()– Get the Order IDget_parent_id()– Get the Parent Order ID (often used for refunds)get_status()– Get the order statusget_currency()– Get the currency used in the orderget_version()– Get the WooCommerce version used when the order was createdget_prices_include_tax()– Check if order prices include taxget_date_created()– Get the order creation dateget_date_modified()– Get the order last modified dateget_discount_total()– Get the total discount amountget_discount_tax()– Get the total discount tax amountget_shipping_total()– Get the total shipping costget_shipping_tax()– Get the total shipping taxget_cart_tax()– Get the total cart taxget_total()– Get the order total amountget_total_tax()– Get the total tax amount for the order
Order Items and Totals
get_items()– Get all items in the order (products, shipping, taxes, etc.)get_items_key()– Get the key used for order itemsget_item_count()– Get the number of items in the orderget_shipping_methods()– Get all shipping methods used in the orderget_address_prop()– Get address properties (billing or shipping)get_billing_first_name()– Get billing first nameget_billing_last_name()– Get billing last nameget_billing_company()– Get billing company nameget_billing_address_1()– Get billing address line 1get_billing_address_2()– Get billing address line 2get_billing_city()– Get billing cityget_billing_state()– Get billing stateget_billing_postcode()– Get billing postcodeget_billing_country()– Get billing countryget_billing_email()– Get billing email addressget_billing_phone()– Get billing phone numberget_shipping_first_name()– Get shipping first nameget_shipping_last_name()– Get shipping last nameget_shipping_company()– Get shipping companyget_shipping_address_1()– Get shipping address line 1get_shipping_address_2()– Get shipping address line 2get_shipping_city()– Get shipping cityget_shipping_state()– Get shipping stateget_shipping_postcode()– Get shipping postcodeget_shipping_country()– Get shipping country
Payment Related
get_payment_method()– Get the payment method IDget_payment_method_title()– Get the title of the payment methodget_transaction_id()– Get the payment transaction IDget_date_paid()– Get the date the order was paidget_total_discount()– Get the total discount amount, optionally including or excluding tax
User Related
get_user()– Get the user object for the order; returns false for guestsget_user_id()– Get the user ID; returns 0 for guests
Customer Related
get_customer_order_notes()– Get customer-related order notesget_customer_note()– Get the note provided by the customer during checkoutget_customer_id()– Get the customer IDget_customer_ip_address()– Get the customer’s IP address at the time of orderget_customer_user_agent()– Get the customer’s browser user agent
Refund Related
get_reason()– Get the reason for a refundget_refunds()– Get refund itemsget_refunded_by()– Get the ID of the user who performed the refundget_refunded_payment()– Get the refund payment methodget_remaining_refund_items()– Get remaining items eligible for refundget_remaining_refund_amount()– Get the remaining amount eligible for refundget_formatted_refund_amount()– Get the formatted refund amountget_qty_refunded_for_item()– Get the quantity refunded for a specific itemget_tax_refunded_for_item()– Get the tax refunded for a specific itemget_total_refunded_for_item()– Get the total amount refunded for a specific item
URL Related
get_checkout_payment_url()– Get the checkout payment URLget_cancel_order_url()– Get the order cancellation URLget_edit_order_url()– Get the URL to edit the orderget_view_order_url()– Get the order view URLget_download_url()– Get the download URL for digital productsget_shipping_address_map_url()– Get the shipping address map URLget_checkout_order_received_url()– Get the ‘Order Received’ URL after successful checkout
Retrieving Custom Field Data
get_meta()– Retrieve specific custom field dataget_meta_data()– Get all custom field data
In addition to the methods listed above, some developers may still use get_post or get_post_meta to retrieve order data. While this works when WooCommerce stores orders as custom post types, it will fail if High-Performance Order Storage (HPOS) is enabled. Therefore, it is highly recommended to use the WC_Order class for custom development. This approach ensures forward compatibility and reduces maintenance as WooCommerce continues to evolve its data structures.
The list above was updated for WooCommerce 7.6. We will continue to update this list as new versions are released. If we missed any methods, please let us know in the comments!
