Method |
Description |
|
__construct ( integer | object | WC_Order $order ) |
Get the order if ID is passed, otherwise the order is new and empty. |
|
add_item ( $item ) |
Adds an order item to this order. The order item will not persist until save. |
|
add_payment_token ( WC_Payment_Token $token ) : boolean | integer |
Add a payment token to an order |
|
add_product ( WC_Product $product, integer $qty = 1, array $args = [] ) : integer |
Add a product line item to the order. This is the only line item type with
it's own method because it saves looking up order amounts (costs are added up for you). |
|
calculate_shipping ( ) : float |
Calculate shipping total. |
|
calculate_taxes ( $args = [] ) |
Calculate taxes for all line items and shipping, and store the totals and tax rows. |
|
calculate_totals ( boolean $and_taxes = true ) : float |
Calculate totals by looking at the contents of the order. Stores the totals and returns the orders final total. |
|
get_cart_tax ( string $context = 'view' ) : float |
Gets cart tax amount. |
|
get_currency ( string $context = 'view' ) : string |
Gets order currency. |
|
get_data ( ) : array |
Get all class data in array format. |
|
get_date_created ( string $context = 'view' ) : integer |
Get date_created. |
|
get_date_modified ( string $context = 'view' ) : integer |
Get date_modified. |
|
get_discount_tax ( string $context = 'view' ) : string |
Get discount_tax. |
|
get_discount_to_display ( $tax_display = '' ) : string |
Get the discount amount (formatted). |
|
get_discount_total ( string $context = 'view' ) : string |
Get discount_total. |
|
get_fees ( ) : array |
Return an array of fees within this order. |
|
get_formatted_line_subtotal ( array $item, string $tax_display = '' ) : string |
Gets line subtotal - formatted for display. |
|
get_formatted_order_total ( ) : string |
Gets order total - formatted for display. |
|
get_item ( integer $item_id ) : WC_Order_Item |
Get an order item object, based on it's type. |
|
get_item_count ( string $item_type = '' ) : string |
Gets the count of order items of a certain type. |
|
get_item_subtotal ( object $item, boolean $inc_tax = false, boolean $round = true ) : float |
Get item subtotal - this is the cost before discount. |
|
get_item_tax ( mixed $item, boolean $round = true ) : float |
Get item tax - useful for gateways. |
|
get_item_total ( object $item, boolean $inc_tax = false, boolean $round = true ) : float |
Calculate item cost - useful for gateways. |
|
get_items ( string | array $types = 'line_item' ) : Array |
Return an array of items/products within this order. |
|
get_items_tax_classes ( ) : array |
Get all tax classes for items in the order. |
|
get_line_subtotal ( object $item, boolean $inc_tax = false, boolean $round = true ) : float |
Get line subtotal - this is the cost before discount. |
|
get_line_tax ( mixed $item ) : float |
Get line tax - useful for gateways. |
|
get_line_total ( object $item, boolean $inc_tax = false, boolean $round = true ) : float |
Calculate line total - useful for gateways. |
|
get_order_item_totals ( mixed $tax_display = '' ) : array |
Get totals for display on pages and in emails. |
|
get_parent_id ( string $context = 'view' ) : integer |
Get parent order ID. |
|
get_payment_tokens ( ) : array |
Returns a list of all payment tokens associated with the current order |
|
get_prices_include_tax ( string $context = 'view' ) : boolean |
Get prices_include_tax. |
|
get_shipping_method ( ) : string |
Gets formatted shipping method title. |
|
get_shipping_methods ( ) : array |
Return an array of shipping costs within this order. |
|
get_shipping_tax ( string $context = 'view' ) : string |
Get shipping_tax. |
|
get_shipping_to_display ( $tax_display = '' ) : string |
Gets shipping (formatted). |
|
get_shipping_total ( string $context = 'view' ) : string |
Get shipping_total. |
|
get_status ( string $context = 'view' ) : string |
Return the order statuses without wc- internal prefix. |
|
get_subtotal ( ) : float |
Gets order subtotal. |
|
get_subtotal_to_display ( boolean $compound = false, string $tax_display = '' ) : string |
Gets subtotal - subtotal is shown before discounts, but with localised taxes. |
|
get_tax_totals ( ) : array |
Get taxes, merged by code, formatted ready for output. |
|
get_taxes ( ) : array |
Return an array of taxes within this order. |
|
get_total ( string $context = 'view' ) : float |
Gets order grand total. incl. taxes. Used in gateways. |
|
get_total_discount ( boolean $ex_tax = true ) : float |
Gets the total discount amount. |
|
get_total_tax ( string $context = 'view' ) : float |
Get total tax amount. Alias for get_order_tax(). |
|
get_type ( ) : string |
Get internal type. |
|
get_used_coupons ( ) : array |
Get coupon codes only. |
|
get_version ( string $context = 'view' ) : string |
Get order_version. |
|
has_free_item ( ) : boolean |
Returns true if the order contains a free product. |
|
has_shipping_method ( string $method_id ) : boolean |
Check whether this order has a specific shipping method or not. |
|
has_status ( $status ) : boolean |
Checks the order status against a passed in status. |
|
remove_item ( integer $item_id ) |
Remove item from the order. |
|
remove_order_items ( string $type = null ) |
Remove all line items (products, coupons, shipping, taxes) from the order. |
|
save ( ) : integer |
Save data to the database. |
|
set_cart_tax ( string $value ) |
Set cart tax. |
|
set_currency ( string $value ) |
Set order_currency. |
|
set_date_created ( string $timestamp ) |
Set date_created. |
|
set_date_modified ( string $timestamp ) |
Set date_modified. |
|
set_discount_tax ( string $value ) |
Set discount_tax. |
|
set_discount_total ( string $value ) |
Set discount_total. |
|
set_parent_id ( integer $value ) |
Set parent order ID. |
|
set_prices_include_tax ( boolean $value ) |
Set prices_include_tax. |
|
set_shipping_tax ( string $value ) |
Set shipping_tax. |
|
set_shipping_total ( string $value ) |
Set shipping_total. |
|
set_status ( string $new_status ) : array |
Set order status. |
|
set_total ( string $value, string $deprecated = '' ) |
Set total. |
|
set_version ( string $value ) |
Set order_version. |
|
update_taxes ( ) |
Update tax lines for the order based on the line item taxes themselves. |
|