public
|
#
__construct( string $id = '' )
Get the order if ID is passed, otherwise the order is new and empty.
Get the order if ID is passed, otherwise the order is new and empty.
Parameters
- $id
string $id (default: '')
|
public
boolean
|
#
get_order( integer $id = 0 )
Gets an order from the database.
Gets an order from the database.
Parameters
- $id
integer $id (default: 0)
Returns
boolean
|
public
|
#
populate( mixed $result )
Populates an order from the loaded post data.
Populates an order from the loaded post data.
Parameters
|
public
boolean
|
#
__isset( mixed $key )
__isset function.
Parameters
Returns
boolean
|
public
mixed
|
#
__get( mixed $key )
__get function.
Parameters
Returns
mixed
|
public
boolean
|
#
key_is_valid( mixed $key )
Check if an order key is valid.
Check if an order key is valid.
Parameters
Returns
boolean
|
public
string
|
#
get_order_number( )
get_order_number function.
get_order_number function.
Gets the order number for display (by default, order ID)
Returns
string
|
public
string
|
|
public
string
|
#
get_billing_address( )
Get the billing address in an array.
Get the billing address in an array.
Returns
string
|
public
string
|
|
public
array
|
#
get_shipping_address( )
Get the shipping address in an array.
Get the shipping address in an array.
Returns
array
|
public
array
|
#
get_items( string|array $type = '' )
Return an array of items/products within this order.
Return an array of items/products within this order.
Parameters
- $type
string|array $type Types of line items to get (array or string)
Returns
array
|
public
string
|
#
get_item_count( mixed $type = '' )
Gets order total - formatted for display.
Gets order total - formatted for display.
Returns
string
|
public
array
|
#
get_fees( )
Return an array of fees within this order.
Return an array of fees within this order.
Returns
array
|
public
array
|
#
get_taxes( )
Return an array of taxes within this order.
Return an array of taxes within this order.
Returns
array
|
public
array
|
#
get_shipping_methods( )
Return an array of shipping costs within this order.
Return an array of shipping costs within this order.
Returns
array
|
public
boolean
|
#
has_shipping_method( string $method_id )
Check whether this order has a specific shipping method or not
Check whether this order has a specific shipping method or not
Parameters
- $method_id
string $method_id
Returns
boolean
|
public
array
|
#
get_tax_totals( )
Get taxes, merged by code, formatted ready for output.
Get taxes, merged by code, formatted ready for output.
Returns
array
|
public
array
|
#
has_meta( string $order_item_id )
has_meta function for order items.
has_meta function for order items.
Parameters
- $order_item_id
string $order_item_id
Returns
array of meta data
|
public
array|string
|
#
get_item_meta( mixed $order_item_id, string $key = '', boolean $single = false )
Get order item meta.
Parameters
- $order_item_id
mixed $order_item_id
- $key
string $key (default: '')
- $single
boolean $single (default: false)
Returns
array|string
|
public
float
|
#
get_cart_discount( )
Gets the total (product) discount amount - these are applied before tax.
Gets the total (product) discount amount - these are applied before tax.
Returns
float
|
public
float
|
#
get_order_discount( )
Gets the total (product) discount amount - these are applied before tax.
Gets the total (product) discount amount - these are applied before tax.
Returns
float
|
public
float
|
#
get_total_discount( )
Gets the total discount amount - both kinds
Gets the total discount amount - both kinds
Returns
float
|
public
float
|
#
get_cart_tax( )
Gets shipping tax amount.
Gets shipping tax amount.
Returns
float
|
public
float
|
#
get_shipping_tax( )
Gets shipping tax amount.
Gets shipping tax amount.
Returns
float
|
public
float
|
#
get_total_tax( )
Gets shipping and product tax.
Gets shipping and product tax.
Returns
float
|
public
float
|
|
public
float
|
|
public
float
|
#
get_item_subtotal( mixed $item, boolean $inc_tax = false, boolean $round = true )
Get item subtotal - this is the cost before discount.
Get item subtotal - this is the cost before discount.
Parameters
- $item
mixed $item
- $inc_tax
boolean $inc_tax (default: false)
- $round
boolean $round (default: true)
Returns
float
|
public
float
|
#
get_line_subtotal( mixed $item, boolean $inc_tax = false, boolean $round = true )
Get line subtotal - this is the cost before discount.
Get line subtotal - this is the cost before discount.
Parameters
- $item
mixed $item
- $inc_tax
boolean $inc_tax (default: false)
- $round
boolean $round (default: true)
Returns
float
|
public
float
|
#
get_item_total( mixed $item, boolean $inc_tax = false, boolean $round = true )
Calculate item cost - useful for gateways.
Calculate item cost - useful for gateways.
Parameters
- $item
mixed $item
- $inc_tax
boolean $inc_tax (default: false)
- $round
boolean $round (default: true)
Returns
float
|
public
float
|
#
get_line_total( mixed $item, boolean $inc_tax = false )
Calculate line total - useful for gateways.
Calculate line total - useful for gateways.
Parameters
- $item
mixed $item
- $inc_tax
boolean $inc_tax (default: false)
Returns
float
|
public
float
|
#
get_item_tax( mixed $item, boolean $round = true )
Calculate item tax - useful for gateways.
Calculate item tax - useful for gateways.
Parameters
- $item
mixed $item
- $round
boolean $round (default: true)
Returns
float
|
public
float
|
#
get_line_tax( mixed $item )
Calculate line tax - useful for gateways.
Calculate line tax - useful for gateways.
Parameters
Returns
float
|
public
string
|
#
get_shipping_method( )
Gets formatted shipping method title.
Gets formatted shipping method title.
Returns
string
|
public
string
|
#
get_formatted_line_subtotal( array $item, string $tax_display = '' )
Gets line subtotal - formatted for display.
Gets line subtotal - formatted for display.
Parameters
- $item
array $item
- $tax_display
string $tax_display
Returns
string
|
public
string
|
|
public
string
|
|
public
string
|
#
get_subtotal_to_display( boolean $compound = false, string $tax_display = '' )
Gets subtotal - subtotal is shown before discounts, but with localised
taxes.
Gets subtotal - subtotal is shown before discounts, but with localised
taxes.
Parameters
- $compound
boolean $compound (default: false)
- $tax_display
string $tax_display (default: the tax_display_cart value)
Returns
string
|
public
string
|
#
get_shipping_to_display( mixed $tax_display = '' )
Gets shipping (formatted).
Gets shipping (formatted).
Returns
string
|
public
string.
|
|
public
string
|
|
public
WC_Product
|
#
get_product_from_item( mixed $item )
Get a product (either product or variation).
Get a product (either product or variation).
Parameters
Returns
|
public
array
|
#
get_order_item_totals( mixed $tax_display = '' )
Get totals for display on pages and in emails.
Get totals for display on pages and in emails.
Returns
array
|
public
string
|
#
email_order_items_table( boolean $show_download_links = false, boolean $show_sku = false, boolean $show_purchase_note = false, boolean $show_image = false, array $image_size = array( 32, 32 ), boolean $plain_text = false )
Output items for display in html emails.
Output items for display in html emails.
Parameters
- $show_download_links
boolean $show_download_links (default: false)
- $show_sku
boolean $show_sku (default: false)
- $show_purchase_note
boolean $show_purchase_note (default: false)
- $show_image
boolean $show_image (default: false)
- $image_size
array $image_size (default: array( 32, 32 )
- $plain_text
boolean plain text
Returns
string
|
public
boolean
|
#
is_download_permitted( )
Checks if product download is permitted
Checks if product download is permitted
Returns
boolean
|
public
boolean
|
#
has_downloadable_item( )
Returns true if the order contains a downloadable product.
Returns true if the order contains a downloadable product.
Returns
boolean
|
public
string
|
#
get_checkout_payment_url( boolean $on_checkout = false )
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.
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.
Parameters
- $on_checkout
boolean $on_checkout
Returns
string
|
public
string
|
|
public
string
|
#
get_cancel_order_url( mixed $redirect = '' )
Generates a URL so that a customer can cancel their (unpaid - pending)
order.
Generates a URL so that a customer can cancel their (unpaid - pending)
order.
Returns
string
|
public
string
|
#
get_view_order_url( )
Generates a URL to view an order from the my account page
Generates a URL to view an order from the my account page
Returns
string
|
public
array
|
#
get_item_downloads( array $item )
Get the downloadable files for an item in this order
Get the downloadable files for an item in this order
Parameters
Returns
array
|
public
string
|
#
get_download_url( integer $product_id, integer $download_id )
Get the Download URL
Parameters
- $product_id
integer $product_id
- $download_id
integer $download_id
Returns
string
|
public
WC_Order::$id
|
#
add_order_note( string $note, integer $is_customer_note = 0 )
Adds a note (comment) to the order
Adds a note (comment) to the order
Parameters
- $note
string $note Note to add
- $is_customer_note
integer $is_customer_note (default: 0) Is this a note for the customer?
Returns
|
public
|
#
update_status( string $new_status_slug, string $note = '' )
Updates status of order
Parameters
- $new_status_slug
string $new_status_slug Status to change the order to
- $note
string $note (default: '') Optional note to add
|
public
|
#
cancel_order( string $note = '' )
Cancel the order and restore the cart (before payment)
Cancel the order and restore the cart (before payment)
Parameters
- $note
string $note (default: '') Optional note to add
|
public
|
#
payment_complete( )
When a payment is complete this function is called
When a payment is complete this function is called
Most of the time this should mark an order as 'processing' so that admin can
process/post the items If the cart contains only downloadable items then the
order is 'complete' since the admin needs to take no action Stock levels are
reduced at this point Sales are also recorded for products Finally, record the
date of payment
|
public
|
|
public
array
|
|
public
|
|
public
|
|
public
|
|
public
|
#
send_stock_notifications( object $product, integer $new_stock, integer $qty_ordered )
send_stock_notifications function.
send_stock_notifications function.
Parameters
- $product
object $product
- $new_stock
integer $new_stock
- $qty_ordered
integer $qty_ordered
|
public
array
|
#
get_customer_order_notes( )
List order notes (public) for the customer
List order notes (public) for the customer
Returns
array
|
public
boolean
|
#
needs_payment( )
Checks if an order needs payment, based on status and order total
Checks if an order needs payment, based on status and order total
Returns
boolean
|