PHP Класс WC_Abstract_Legacy_Order

Legacy and deprecated functions are here to keep the WC_Abstract_Order clean. This class will be removed in future versions.
Автор: WooThemes
Наследование: extends WC_Data
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__get ( string $key ) : mixed Magic __get method for backwards compatibility.
__isset ( string $key ) : boolean Magic __isset method for backwards compatibility.
add_coupon ( string $code = [], integer $discount, integer $discount_tax ) : integer Add coupon code to the order.
add_fee ( object $fee ) : integer Add a fee to the order.
add_shipping ( $shipping_rate ) : integer Add a shipping row to the order.
add_tax ( $tax_rate_id, integer $tax_amount, integer $shipping_tax_amount ) : integer Add a tax row to the order.
cancel_order ( string $note = '' ) Cancel the order and restore the cart (before payment).
decrease_coupon_usage_counts ( ) Decrease applied coupon counts.
display_item_downloads ( array $item ) Display download links for an order item.
display_item_meta ( array $item ) Display meta data belonging to an item.
email_order_items_table ( array $args = [] ) : string Output items for display in html emails.
expand_item_meta ( array $item ) : array Expand item meta into the $item array.
get_download_url ( integer $product_id, integer $download_id ) : string Get the Download URL.
get_item_downloads ( array $item ) : array Get the downloadable files for an item in this order.
get_item_meta ( mixed $order_item_id, string $key = '', boolean $single = false ) : array | string Get order item meta.
get_item_meta_array ( mixed $order_item_id ) : array Get all item meta data in array format in the order it was saved. Does not group meta by key like get_item_meta().
get_order ( integer $id ) : boolean Gets an order from the database.
get_order_currency ( ) Get currency.
get_product_from_item ( object $item ) : WC_Product | boolean Get a product (either product or variation).
get_total_shipping ( ) : float Gets shipping total. Alias of WC_Order::get_shipping_total().
has_meta ( string $order_item_id ) : array has_meta function for order items.
increase_coupon_usage_counts ( ) Increase applied coupon counts.
legacy_set_total ( float $amount, string $total_type = 'total' ) : boolean Set an order total.
populate ( mixed $result ) Populates an order from the loaded post data.
record_product_sales ( ) Record sales.
reduce_order_stock ( ) Reduce stock levels for all line items in the order.
send_stock_notifications ( $product, $new_stock, $qty_ordered ) Send the stock notifications.
set_address ( array $address, string $type = 'billing' ) Set the customer address.
update_coupon ( object | integer $item, array $args ) : integer Update coupon for order. Note this does not update order totals.
update_fee ( object | integer $item, array $args ) : integer Update fee for order.
update_product ( object | integer $item, WC_Product $product, array $args ) : integer Update a line item for the order.
update_shipping ( object | integer $item, array $args ) : integer Update shipping method for order.
update_tax ( object | integer $item, array $args ) : integer Update tax line on order.

Защищенные методы

Метод Описание
init ( integer | object | WC_Order $order ) Load the order object. Called from the constructor.

Описание методов

__get() публичный Метод

Magic __get method for backwards compatibility.
public __get ( string $key ) : mixed
$key string
Результат mixed

__isset() публичный Метод

Magic __isset method for backwards compatibility.
public __isset ( string $key ) : boolean
$key string
Результат boolean

add_coupon() публичный Метод

Add coupon code to the order.
public add_coupon ( string $code = [], integer $discount, integer $discount_tax ) : integer
$code string
$discount integer tax amount.
$discount_tax integer amount.
Результат integer order item ID

add_fee() публичный Метод

Order must be saved prior to adding items.
public add_fee ( object $fee ) : integer
$fee object
Результат integer updated order item ID

add_shipping() публичный Метод

Add a shipping row to the order.
public add_shipping ( $shipping_rate ) : integer
Результат integer order item ID

add_tax() публичный Метод

Add a tax row to the order.
public add_tax ( $tax_rate_id, integer $tax_amount, integer $shipping_tax_amount ) : integer
$tax_amount integer amount of tax.
$shipping_tax_amount integer shipping amount.
Результат integer order item ID

cancel_order() публичный Метод

Cancel the order and restore the cart (before payment).
Устаревший: 2.7.0 Moved to event handler.
public cancel_order ( string $note = '' )
$note string (default: '') Optional note to add.

decrease_coupon_usage_counts() публичный Метод

Decrease applied coupon counts.
Устаревший: 2.7.0

display_item_downloads() публичный Метод

Display download links for an order item.
public display_item_downloads ( array $item )
$item array

display_item_meta() публичный Метод

Display meta data belonging to an item.
public display_item_meta ( array $item )
$item array

email_order_items_table() публичный Метод

Output items for display in html emails.
Устаревший: 2.7.0 Moved to template functions.
public email_order_items_table ( array $args = [] ) : string
$args array Items args.
Результат string

expand_item_meta() публичный Метод

Expand item meta into the $item array.
Устаревший: 2.7.0 Item meta no longer expanded due to new order item classes. This function now does nothing to avoid data breakage.
public expand_item_meta ( array $item ) : array
$item array before expansion.
Результат array

get_download_url() публичный Метод

Get the Download URL.
public get_download_url ( integer $product_id, integer $download_id ) : string
$product_id integer
$download_id integer
Результат string

get_item_downloads() публичный Метод

Get the downloadable files for an item in this order.
public get_item_downloads ( array $item ) : array
$item array
Результат array

get_item_meta() публичный Метод

Get order item meta.
Устаревший: 2.7.0
public get_item_meta ( mixed $order_item_id, string $key = '', boolean $single = false ) : array | string
$order_item_id mixed
$key string (default: '')
$single boolean (default: false)
Результат array | string

get_item_meta_array() публичный Метод

Get all item meta data in array format in the order it was saved. Does not group meta by key like get_item_meta().
public get_item_meta_array ( mixed $order_item_id ) : array
$order_item_id mixed
Результат array of objects

get_order() публичный Метод

Gets an order from the database.
Устаревший: 2.7
public get_order ( integer $id ) : boolean
$id integer (default: 0).
Результат boolean

get_order_currency() публичный Метод

Get currency.
Устаревший: 2.7.0
public get_order_currency ( )

get_product_from_item() публичный Метод

Get a product (either product or variation).
Устаревший: Add deprecation notices in future release. Replaced with $item->get_product()
public get_product_from_item ( object $item ) : WC_Product | boolean
$item object
Результат WC_Product | boolean

get_total_shipping() публичный Метод

Gets shipping total. Alias of WC_Order::get_shipping_total().
Устаревший: 2.7.0 since this is an alias only.
public get_total_shipping ( ) : float
Результат float

has_meta() публичный Метод

has_meta function for order items.
public has_meta ( string $order_item_id ) : array
$order_item_id string
Результат array of meta data.

increase_coupon_usage_counts() публичный Метод

Increase applied coupon counts.
Устаревший: 2.7.0

init() защищенный Метод

Load the order object. Called from the constructor.
Устаревший: 2.7.0 Logic moved to constructor
protected init ( integer | object | WC_Order $order )
$order integer | object | WC_Order Order to init.

legacy_set_total() публичный Метод

Set an order total.
public legacy_set_total ( float $amount, string $total_type = 'total' ) : boolean
$amount float
$total_type string
Результат boolean

populate() публичный Метод

Populates an order from the loaded post data.
Устаревший: 2.7
public populate ( mixed $result )
$result mixed

record_product_sales() публичный Метод

Record sales.
Устаревший: 2.7.0

reduce_order_stock() публичный Метод

Reduce stock levels for all line items in the order.
Устаревший: 2.7.0
public reduce_order_stock ( )

send_stock_notifications() публичный Метод

Send the stock notifications.
Устаревший: 2.7.0 No longer needs to be called directly.
public send_stock_notifications ( $product, $new_stock, $qty_ordered )

set_address() публичный Метод

Set the customer address.
public set_address ( array $address, string $type = 'billing' )
$address array Address data.
$type string billing or shipping.

update_coupon() публичный Метод

Update coupon for order. Note this does not update order totals.
public update_coupon ( object | integer $item, array $args ) : integer
$item object | integer
$args array
Результат integer updated order item ID

update_fee() публичный Метод

Note this does not update order totals.
public update_fee ( object | integer $item, array $args ) : integer
$item object | integer
$args array
Результат integer updated order item ID

update_product() публичный Метод

Note this does not update order totals.
public update_product ( object | integer $item, WC_Product $product, array $args ) : integer
$item object | integer order item ID or item object.
$product WC_Product
$args array data to update.
Результат integer updated order item ID

update_shipping() публичный Метод

Note this does not update the order total.
public update_shipping ( object | integer $item, array $args ) : integer
$item object | integer
$args array
Результат integer updated order item ID

update_tax() публичный Метод

Note this does not update order totals.
С версии: 2.7
public update_tax ( object | integer $item, array $args ) : integer
$item object | integer
$args array
Результат integer updated order item ID