Свойство | Тип | Описание | |
---|---|---|---|
$base | string | the route base | |
$post_type | string | the custom post type |
Метод | Описание | |
---|---|---|
bulk ( array $data ) : array | Bulk update or insert orders Accepts an array with orders in the formats supported by WC_API_Orders->create_order() and WC_API_Orders->edit_order() | |
create_order ( array $data ) : array | Create an order | |
create_order_note ( string $order_id, array $data ) : WP_Error | array | Create a new order note for the given order | |
create_order_refund ( string $order_id, array $data, boolean $api_refund = true ) : WP_Error | array | Create a new order refund for the given order | |
delete_order ( integer $id, boolean $force = false ) : array | Delete an order | |
delete_order_note ( string $order_id, string $id ) : WP_Error | array | Delete order note | |
delete_order_refund ( string $order_id, string $id ) : WP_Error | array | Delete order refund | |
edit_order ( integer $id, array $data ) : array | Edit an order | |
edit_order_note ( string $order_id, string $id, array $data ) : WP_Error | array | Edit the order note | |
edit_order_refund ( string $order_id, string $id, array $data ) : WP_Error | array | Edit an order refund | |
get_order ( integer $id, array $fields = null ) : array | Get the order for the given ID | |
get_order ( integer $id, array $fields = null, array $filter = [] ) : array | Get the order for the given ID. | |
get_order_note ( string $order_id, string $id, string | null $fields = null ) : array | Get an order note for the given order ID and ID | |
get_order_notes ( integer $id, string $fields = null ) : array | Get the admin order notes for an order | |
get_order_notes ( string $order_id, string | null $fields = null ) : array | Get the admin order notes for an order | |
get_order_refund ( string $order_id, $id, string | null $fields = null ) : array | Get an order refund for the given order ID and ID | |
get_order_refunds ( string $order_id, string | null $fields = null ) : array | Get the order refunds for an order | |
get_order_statuses ( ) : array | Get a list of valid order statuses | |
get_orders ( string $fields = null, array $filter = [], string $status = null, integer $page = 1 ) : array | Get all orders | |
get_orders_count ( string $status = null, array $filter = [] ) : array | Get the total number of orders | |
get_variation_id ( $product, $variations = [] ) : integer | Given a product ID & API provided variations, find the correct variation ID to use for calculation We can't just trust input from the API to pass a variation_id manually, otherwise you could pass the cheapest variation ID but provide other information so we have to look up the variation ID. | |
get_variation_id ( WC_Product $product, $variations = [] ) : integer | Given a product ID & API provided variations, find the correct variation ID to use for calculation We can't just trust input from the API to pass a variation_id manually, otherwise you could pass the cheapest variation ID but provide other information so we have to look up the variation ID. | |
register_routes ( array $routes ) : array | Register the routes for this class |
Метод | Описание | |
---|---|---|
array_contains ( $needles, $haystack ) | Utility function to see if the meta array contains data from variations | |
create_base_order ( $args, $data ) : WC_Order | Creates new WC_Order. | |
item_is_null ( array $item ) : boolean | Helper method to check if the resource ID associated with the provided item is null | |
query_orders ( array $args ) : WP_Query | Helper method to get order post objects | |
set_coupon ( WC_Order $order, array $coupon, string $action ) | Create or update an order coupon | |
set_fee ( WC_Order $order, array $fee, string $action ) | Create or update an order fee | |
set_item ( WC_Order $order, string $item_type, array $item, string $action ) | Wrapper method to create/update order items | |
set_line_item ( WC_Order $order, array $item, string $action ) | Create or update a line item | |
set_order_addresses ( WC_Order $order, array $data ) | Helper method to set/update the billing & shipping addresses for an order | |
set_order_meta ( integer $order_id, array $order_meta ) | Helper method to add/update order meta, with two restrictions: | |
set_shipping ( WC_Order $order, array $shipping, string $action ) | Create or update an order shipping method | |
update_address ( WC_Order $order, array $posted, string $type = 'billing' ) | Update address. |
Метод | Описание | |
---|---|---|
get_order_subtotal ( WC_Order $order ) : float | Helper method to get the order subtotal |
protected array_contains ( $needles, $haystack ) |
protected create_base_order ( $args, $data ) : WC_Order | ||
$args | array | |
Результат | WC_Order |
public create_order ( array $data ) : array | ||
$data | array | raw order data |
Результат | array |
public get_order_statuses ( ) : array | ||
Результат | array |
public get_variation_id ( $product, $variations = [] ) : integer | ||
Результат | integer | returns an ID if a valid variation was found for this product |
public get_variation_id ( WC_Product $product, $variations = [] ) : integer | ||
$product | WC_Product | Product instance |
Результат | integer | Returns an ID if a valid variation was found for this product |
protected item_is_null ( array $item ) : boolean | ||
$item | array | item provided in the request body |
Результат | boolean | true if the item resource ID is null, false otherwise |
protected query_orders ( array $args ) : WP_Query | ||
$args | array | request arguments for filtering query |
Результат | WP_Query |
public register_routes ( array $routes ) : array | ||
$routes | array | |
Результат | array |
protected set_coupon ( WC_Order $order, array $coupon, string $action ) | ||
$order | WC_Order | |
$coupon | array | item data |
$action | string | 'create' to add coupon or 'update' to update it |
protected set_line_item ( WC_Order $order, array $item, string $action ) | ||
$order | WC_Order | |
$item | array | line item data |
$action | string | 'create' to add line item or 'update' to update it |
protected set_order_addresses ( WC_Order $order, array $data ) | ||
$order | WC_Order | |
$data | array |
protected set_order_meta ( integer $order_id, array $order_meta ) | ||
$order_id | integer | valid order ID |
$order_meta | array | order meta in array( 'meta_key' => 'meta_value' ) format |
protected set_shipping ( WC_Order $order, array $shipping, string $action ) | ||
$order | WC_Order | |
$shipping | array | item data |
$action | string | 'create' to add shipping or 'update' to update it |
protected update_address ( WC_Order $order, array $posted, string $type = 'billing' ) | ||
$order | WC_Order | |
$posted | array | |
$type | string |