Property | Type | Description | |
---|---|---|---|
$data | array | Order Data array. This is the core order data exposed in APIs since 2.7.0. | |
$status_transition | boolean | array | Stores data about status changes so relevant hooks can be fired. |
Method | Description | |
---|---|---|
add_order_note ( string $note, integer $is_customer_note, $added_by_user = false ) : integer | Adds a note (comment) to the order. Order must exist. | |
get_address ( string $type = 'billing' ) : array | Returns the requested address in raw, non-formatted way. | |
get_billing_address_1 ( string $context = 'view' ) : string | Get billing_address_1. | |
get_billing_address_2 ( string $context = 'view' ) : string | Get billing_address_2. | |
get_billing_city ( string $context = 'view' ) : string | Get billing_city. | |
get_billing_company ( string $context = 'view' ) : string | Get billing_company. | |
get_billing_country ( string $context = 'view' ) : string | Get billing_country. | |
get_billing_email ( string $context = 'view' ) : string | Get billing_email. | |
get_billing_first_name ( string $context = 'view' ) : string | Get billing_first_name. | |
get_billing_last_name ( string $context = 'view' ) : string | Get billing_last_name. | |
get_billing_phone ( string $context = 'view' ) : string | Get billing_phone. | |
get_billing_postcode ( string $context = 'view' ) : string | Get billing_postcode. | |
get_billing_state ( string $context = 'view' ) : string | Get billing_state. | |
get_cancel_endpoint ( ) : string | Helper method to return the cancel endpoint. | |
get_cancel_order_url ( string $redirect = '' ) : string | Generates a URL so that a customer can cancel their (unpaid - pending) order. | |
get_cancel_order_url_raw ( string $redirect = '' ) : string | Generates a raw (unescaped) cancel-order URL for use by payment gateways. | |
get_cart_hash ( string $context = 'view' ) : string | Get cart hash. | |
get_checkout_order_received_url ( ) : string | Generates a URL for the thanks page (order received). | |
get_checkout_payment_url ( boolean $on_checkout = false ) : string | Generates a URL so that a customer can pay for their (unpaid - pending) order. Pass 'true' for the checkout version which doesn't offer gateway choices. | |
get_created_via ( string $context = 'view' ) : string | Get created_via. | |
get_customer_id ( string $context = 'view' ) : integer | Get customer_id. | |
get_customer_ip_address ( string $context = 'view' ) : string | Get customer_ip_address. | |
get_customer_note ( string $context = 'view' ) : string | Get customer_note. | |
get_customer_order_notes ( ) : array | List order notes (public) for the customer. | |
get_customer_user_agent ( string $context = 'view' ) : string | Get customer_user_agent. | |
get_data ( ) : array | Get all class data in array format. | |
get_date_completed ( string $context = 'view' ) : integer | Get date_completed. | |
get_date_paid ( string $context = 'view' ) : integer | Get date_paid. | |
get_formatted_billing_address ( ) : string | Get a formatted billing address for the order. | |
get_formatted_billing_full_name ( ) : string | Get a formatted billing full name. | |
get_formatted_order_total ( string $tax_display = '', boolean $display_refunded = true ) : string | Gets order total - formatted for display. | |
get_formatted_shipping_address ( ) : string | Get a formatted shipping address for the order. | |
get_formatted_shipping_full_name ( ) : string | Get a formatted shipping full name. | |
get_item_count_refunded ( string $item_type = '' ) : string | Gets the count of order items of a certain type that have been refunded. | |
get_order_key ( string $context = 'view' ) : string | Get order key. | |
get_order_number ( ) : string | get_order_number function. | |
get_payment_method ( string $context = 'view' ) : string | Get the payment method. | |
get_payment_method_title ( string $context = 'view' ) : string | Get payment_method_title. | |
get_qty_refunded_for_item ( integer $item_id, string $item_type = 'line_item' ) : integer | Get the refunded amount for a line item. | |
get_refunds ( ) : array | Get order refunds. | |
get_remaining_refund_amount ( ) : string | How much money is left to refund? | |
get_remaining_refund_items ( ) : integer | How many items are left to refund? | |
get_shipping_address_1 ( string $context = 'view' ) : string | Get shipping_address_1. | |
get_shipping_address_2 ( string $context = 'view' ) : string | Get shipping_address_2. | |
get_shipping_address_map_url ( ) : string | Get a formatted shipping address for the order. | |
get_shipping_city ( string $context = 'view' ) : string | Get shipping_city. | |
get_shipping_company ( string $context = 'view' ) : string | Get shipping_company. | |
get_shipping_country ( string $context = 'view' ) : string | Get shipping_country. | |
get_shipping_first_name ( string $context = 'view' ) : string | Get shipping_first_name. | |
get_shipping_last_name ( string $context = 'view' ) : string | Get shipping_last_name. | |
get_shipping_postcode ( string $context = 'view' ) : string | Get shipping_postcode. | |
get_shipping_state ( string $context = 'view' ) : string | Get shipping_state. | |
get_tax_refunded_for_item ( integer $item_id, integer $tax_id, string $item_type = 'line_item' ) : double | Get the refunded amount for a line item. | |
get_total_qty_refunded ( string $item_type = 'line_item' ) : integer | Get the total number of items refunded. | |
get_total_refunded ( ) : string | Get amount already refunded. | |
get_total_refunded_for_item ( integer $item_id, string $item_type = 'line_item' ) : integer | Get the refunded amount for a line item. | |
get_total_shipping_refunded ( ) : float | Get the total shipping refunded. | |
get_total_tax_refunded ( ) : float | Get the total tax refunded. | |
get_total_tax_refunded_by_rate_id ( integer $rate_id ) : float | Get total tax refunded by rate ID. | |
get_transaction_id ( string $context = 'view' ) : string | Get transaction_id. | |
get_user ( ) : WP_User | false | Get the user associated with the order. False for guests. | |
get_user_id ( string $context = 'view' ) : integer | Alias for get_customer_id(). | |
get_view_order_url ( ) : string | Generates a URL to view an order from the my account page. | |
has_cart_hash ( $cart_hash = '' ) : boolean | See if order matches cart_hash. | |
has_downloadable_item ( ) : boolean | Returns true if the order contains a downloadable product. | |
is_download_permitted ( ) : boolean | Checks if product download is permitted. | |
is_editable ( ) : boolean | Checks if an order can be edited, specifically for use on the Edit Order screen. | |
is_paid ( ) : boolean | Returns if an order has been paid for based on the order status. | |
key_is_valid ( mixed $key ) : boolean | Check if an order key is valid. | |
needs_payment ( ) : boolean | Checks if an order needs payment, based on status and order total. | |
needs_shipping_address ( ) : boolean | Checks if an order needs display the shipping address, based on shipping method. | |
payment_complete ( string $transaction_id = '' ) : boolean | When a payment is complete this function is called. | |
save ( ) : integer | Save data to the database. | |
set_billing_address_1 ( string $value ) | Set billing_address_1. | |
set_billing_address_2 ( string $value ) | Set billing_address_2. | |
set_billing_city ( string $value ) | Set billing_city. | |
set_billing_company ( string $value ) | Set billing_company. | |
set_billing_country ( string $value ) | Set billing_country. | |
set_billing_email ( string $value ) | Set billing_email. | |
set_billing_first_name ( string $value ) | Set billing_first_name. | |
set_billing_last_name ( string $value ) | Set billing_last_name. | |
set_billing_phone ( string $value ) | Set billing_phone. | |
set_billing_postcode ( string $value ) | Set billing_postcode. | |
set_billing_state ( string $value ) | Set billing_state. | |
set_cart_hash ( string $value ) | Set cart hash. | |
set_created_via ( string $value ) | Set created_via. | |
set_customer_id ( integer $value ) | Set customer_id. | |
set_customer_ip_address ( string $value ) | Set customer_ip_address. | |
set_customer_note ( string $value ) | Set customer_note. | |
set_customer_user_agent ( string $value ) | Set customer_user_agent. | |
set_date_completed ( string $timestamp ) | Set date_completed. | |
set_date_paid ( string $timestamp ) | Set date_paid. | |
set_order_key ( string $value ) | Set order_key. | |
set_payment_method ( string $payment_method = '' ) | Set the payment method. | |
set_payment_method_title ( string $value ) | Set payment_method_title. | |
set_shipping_address_1 ( string $value ) | Set shipping_address_1. | |
set_shipping_address_2 ( string $value ) | Set shipping_address_2. | |
set_shipping_city ( string $value ) | Set shipping_city. | |
set_shipping_company ( string $value ) | Set shipping_company. | |
set_shipping_country ( string $value ) | Set shipping_country. | |
set_shipping_first_name ( string $value ) | Set shipping_first_name. | |
set_shipping_last_name ( string $value ) | Set shipping_last_name. | |
set_shipping_postcode ( string $value ) | Set shipping_postcode. | |
set_shipping_state ( string $value ) | Set shipping_state. | |
set_status ( string $new_status, string $note = '', boolean $manual_update = false ) | Set order status. | |
set_transaction_id ( string $value ) | Set transaction_id. | |
update_status ( $new_status, $note = '', $manual = false ) : boolean | Updates status of order immediately. Order must exist. |
Method | Description | |
---|---|---|
get_address_prop ( string $prop, string $address = 'billing', string $context = 'view' ) : mixed | Gets a prop for a getter method. | |
maybe_set_user_billing_email ( ) | Maybe set empty billing email to that of the user who owns the order. | |
set_address_prop ( string $prop, string $address = 'billing', mixed $value ) | Sets a prop for a setter method. | |
status_transition ( ) | Handle the status transition. |
public get_address ( string $type = 'billing' ) : array | ||
$type | string | Billing or shipping. Anything else besides 'billing' will return shipping address. |
return | array | The stored address after filter. |
public get_billing_address_1 ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_address_2 ( string $context = 'view' ) : string | ||
$context | string | |
return | string | $value |
public get_billing_city ( string $context = 'view' ) : string | ||
$context | string | |
return | string | $value |
public get_billing_company ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_country ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_email ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_first_name ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_last_name ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_phone ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_postcode ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_billing_state ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_cancel_endpoint ( ) : string | ||
return | string | the cancel endpoint; either the cart page or the home page. |
public get_cancel_order_url ( string $redirect = '' ) : string | ||
$redirect | string | |
return | string |
public get_cancel_order_url_raw ( string $redirect = '' ) : string | ||
$redirect | string | |
return | string | The unescaped cancel-order URL. |
public get_cart_hash ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_checkout_order_received_url ( ) : string | ||
return | string |
public get_checkout_payment_url ( boolean $on_checkout = false ) : string | ||
$on_checkout | boolean | |
return | string |
public get_created_via ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_customer_id ( string $context = 'view' ) : integer | ||
$context | string | |
return | integer |
public get_customer_ip_address ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_customer_note ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_customer_order_notes ( ) : array | ||
return | array |
public get_customer_user_agent ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_date_completed ( string $context = 'view' ) : integer | ||
$context | string | |
return | integer |
public get_date_paid ( string $context = 'view' ) : integer | ||
$context | string | |
return | integer |
public get_formatted_billing_address ( ) : string | ||
return | string |
public get_formatted_billing_full_name ( ) : string | ||
return | string |
public get_formatted_shipping_address ( ) : string | ||
return | string |
public get_formatted_shipping_full_name ( ) : string | ||
return | string |
public get_item_count_refunded ( string $item_type = '' ) : string | ||
$item_type | string | |
return | string |
public get_order_key ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_order_number ( ) : string | ||
return | string |
public get_payment_method ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_payment_method_title ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_refunds ( ) : array | ||
return | array | of WC_Order_Refund objects |
public get_remaining_refund_amount ( ) : string | ||
return | string |
public get_remaining_refund_items ( ) : integer | ||
return | integer |
public get_shipping_address_1 ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_address_2 ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_address_map_url ( ) : string | ||
return | string |
public get_shipping_city ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_company ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_country ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_first_name ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_last_name ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_postcode ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_shipping_state ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_total_qty_refunded ( string $item_type = 'line_item' ) : integer | ||
$item_type | string | type of the item we're checking, if not a line_item |
return | integer |
public get_total_refunded ( ) : string | ||
return | string |
public get_total_shipping_refunded ( ) : float | ||
return | float |
public get_total_tax_refunded ( ) : float | ||
return | float |
public get_total_tax_refunded_by_rate_id ( integer $rate_id ) : float | ||
$rate_id | integer | |
return | float |
public get_transaction_id ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_user ( ) : WP_User | false | ||
return | WP_User | false |
public get_user_id ( string $context = 'view' ) : integer | ||
$context | string | |
return | integer |
public get_view_order_url ( ) : string | ||
return | string |
public has_cart_hash ( $cart_hash = '' ) : boolean | ||
return | boolean |
public has_downloadable_item ( ) : boolean | ||
return | boolean |
public is_download_permitted ( ) : boolean | ||
return | boolean |
public is_editable ( ) : boolean | ||
return | boolean |
public key_is_valid ( mixed $key ) : boolean | ||
$key | mixed | |
return | boolean |
protected maybe_set_user_billing_email ( ) |
public needs_payment ( ) : boolean | ||
return | boolean |
public needs_shipping_address ( ) : boolean | ||
return | boolean |
public payment_complete ( string $transaction_id = '' ) : boolean | ||
$transaction_id | string | Optional transaction id to store in post meta. |
return | boolean | success |
public set_billing_address_1 ( string $value ) | ||
$value | string |
public set_billing_address_2 ( string $value ) | ||
$value | string |
public set_billing_city ( string $value ) | ||
$value | string |
public set_billing_company ( string $value ) | ||
$value | string |
public set_billing_country ( string $value ) | ||
$value | string |
public set_billing_email ( string $value ) | ||
$value | string |
public set_billing_first_name ( string $value ) | ||
$value | string |
public set_billing_last_name ( string $value ) | ||
$value | string |
public set_billing_phone ( string $value ) | ||
$value | string |
public set_billing_postcode ( string $value ) | ||
$value | string |
public set_billing_state ( string $value ) | ||
$value | string |
public set_created_via ( string $value ) | ||
$value | string |
public set_customer_id ( integer $value ) | ||
$value | integer |
public set_customer_ip_address ( string $value ) | ||
$value | string |
public set_customer_note ( string $value ) | ||
$value | string |
public set_customer_user_agent ( string $value ) | ||
$value | string |
public set_date_completed ( string $timestamp ) | ||
$timestamp | string |
public set_date_paid ( string $timestamp ) | ||
$timestamp | string |
public set_order_key ( string $value ) | ||
$value | string | Max length 20 chars. |
public set_payment_method ( string $payment_method = '' ) | ||
$payment_method | string | Supports WC_Payment_Gateway for bw compatibility with < 2.7 |
public set_payment_method_title ( string $value ) | ||
$value | string |
public set_shipping_address_1 ( string $value ) | ||
$value | string |
public set_shipping_address_2 ( string $value ) | ||
$value | string |
public set_shipping_city ( string $value ) | ||
$value | string |
public set_shipping_company ( string $value ) | ||
$value | string |
public set_shipping_country ( string $value ) | ||
$value | string |
public set_shipping_first_name ( string $value ) | ||
$value | string |
public set_shipping_last_name ( string $value ) | ||
$value | string |
public set_shipping_postcode ( string $value ) | ||
$value | string |
public set_shipping_state ( string $value ) | ||
$value | string |
public set_transaction_id ( string $value ) | ||
$value | string |
public update_status ( $new_status, $note = '', $manual = false ) : boolean | ||
return | boolean | success |
protected array $data | ||
return | array |