PHP 클래스 WC_API_Orders

상속: extends WC_API_Resource
파일 보기 프로젝트 열기: woocommerce/woocommerce

보호된 프로퍼티들

프로퍼티 타입 설명
$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

메소드 상세

array_contains() 보호된 메소드

Utility function to see if the meta array contains data from variations
protected array_contains ( $needles, $haystack )

bulk() 공개 메소드

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()
부터: 2.4.0
public bulk ( array $data ) : array
$data array
리턴 array

create_base_order() 보호된 메소드

Requires a separate function for classes that extend WC_API_Orders.
부터: 2.3
protected create_base_order ( $args, $data ) : WC_Order
$args array
리턴 WC_Order

create_order() 공개 메소드

Create an order
부터: 2.2
public create_order ( array $data ) : array
$data array raw order data
리턴 array

create_order_note() 공개 메소드

Create a new order note for the given order
부터: 2.2
public create_order_note ( string $order_id, array $data ) : WP_Error | array
$order_id string order ID
$data array raw request data
리턴 WP_Error | array error or created note response data

create_order_refund() 공개 메소드

Create a new order refund for the given order
부터: 2.2
public create_order_refund ( string $order_id, array $data, boolean $api_refund = true ) : WP_Error | array
$order_id string order ID
$data array raw request data
$api_refund boolean do refund using a payment gateway API
리턴 WP_Error | array error or created refund response data

delete_order() 공개 메소드

Delete an order
public delete_order ( integer $id, boolean $force = false ) : array
$id integer the order ID
$force boolean true to permanently delete order, false to move to trash
리턴 array

delete_order_note() 공개 메소드

Delete order note
부터: 2.2
public delete_order_note ( string $order_id, string $id ) : WP_Error | array
$order_id string order ID
$id string note ID
리턴 WP_Error | array error or deleted message

delete_order_refund() 공개 메소드

Delete order refund
부터: 2.2
public delete_order_refund ( string $order_id, string $id ) : WP_Error | array
$order_id string order ID
$id string refund ID
리턴 WP_Error | array error or deleted message

edit_order() 공개 메소드

Edit an order
부터: 2.2
public edit_order ( integer $id, array $data ) : array
$id integer the order ID
$data array
리턴 array

edit_order_note() 공개 메소드

Edit the order note
부터: 2.2
public edit_order_note ( string $order_id, string $id, array $data ) : WP_Error | array
$order_id string order ID
$id string note ID
$data array parsed request data
리턴 WP_Error | array error or edited note response data

edit_order_refund() 공개 메소드

Edit an order refund
부터: 2.2
public edit_order_refund ( string $order_id, string $id, array $data ) : WP_Error | array
$order_id string order ID
$id string refund ID
$data array parsed request data
리턴 WP_Error | array error or edited refund response data

get_order() 공개 메소드

Get the order for the given ID
부터: 2.1
public get_order ( integer $id, array $fields = null ) : array
$id integer the order ID
$fields array
리턴 array

get_order() 공개 메소드

Get the order for the given ID.
부터: 2.1
public get_order ( integer $id, array $fields = null, array $filter = [] ) : array
$id integer The order ID.
$fields array Request fields.
$filter array Request filters.
리턴 array

get_order_note() 공개 메소드

Get an order note for the given order ID and ID
부터: 2.2
public get_order_note ( string $order_id, string $id, string | null $fields = null ) : array
$order_id string order ID
$id string order note ID
$fields string | null fields to limit response to
리턴 array

get_order_notes() 공개 메소드

Get the admin order notes for an order
부터: 2.1
public get_order_notes ( integer $id, string $fields = null ) : array
$id integer the order ID
$fields string fields to include in response
리턴 array

get_order_notes() 공개 메소드

Get the admin order notes for an order
부터: 2.1
public get_order_notes ( string $order_id, string | null $fields = null ) : array
$order_id string order ID
$fields string | null fields to include in response
리턴 array

get_order_refund() 공개 메소드

Get an order refund for the given order ID and ID
부터: 2.2
public get_order_refund ( string $order_id, $id, string | null $fields = null ) : array
$order_id string order ID
$fields string | null fields to limit response to
리턴 array

get_order_refunds() 공개 메소드

Get the order refunds for an order
부터: 2.2
public get_order_refunds ( string $order_id, string | null $fields = null ) : array
$order_id string order ID
$fields string | null fields to include in response
리턴 array

get_order_statuses() 공개 메소드

Note this requires no specific permissions other than being an authenticated API user. Order statuses (particularly custom statuses) could be considered private information which is why it's not in the API index.
부터: 2.1
public get_order_statuses ( ) : array
리턴 array

get_orders() 공개 메소드

Get all orders
부터: 2.1
public get_orders ( string $fields = null, array $filter = [], string $status = null, integer $page = 1 ) : array
$fields string
$filter array
$status string
$page integer
리턴 array

get_orders_count() 공개 메소드

Get the total number of orders
부터: 2.4
public get_orders_count ( string $status = null, array $filter = [] ) : array
$status string
$filter array
리턴 array

get_variation_id() 공개 메소드

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.
public get_variation_id ( $product, $variations = [] ) : integer
리턴 integer returns an ID if a valid variation was found for this product

get_variation_id() 공개 메소드

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.
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

item_is_null() 보호된 메소드

Items can be deleted by setting the resource ID to null
부터: 2.2
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

query_orders() 보호된 메소드

Helper method to get order post objects
부터: 2.1
protected query_orders ( array $args ) : WP_Query
$args array request arguments for filtering query
리턴 WP_Query

register_routes() 공개 메소드

GET|POST /orders GET /orders/count GET|PUT|DELETE /orders/ GET /orders//notes
부터: 2.1
public register_routes ( array $routes ) : array
$routes array
리턴 array

set_coupon() 보호된 메소드

Create or update an order coupon
부터: 2.2
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

set_fee() 보호된 메소드

Create or update an order fee
부터: 2.2
protected set_fee ( WC_Order $order, array $fee, string $action )
$order WC_Order
$fee array item data
$action string 'create' to add fee or 'update' to update it

set_item() 보호된 메소드

When updating, the item ID provided is checked to ensure it is associated with the order.
부터: 2.2
protected set_item ( WC_Order $order, string $item_type, array $item, string $action )
$order WC_Order order
$item_type string
$item array item provided in the request body
$action string either 'create' or 'update'

set_line_item() 보호된 메소드

Create or update a line item
부터: 2.2
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

set_order_addresses() 보호된 메소드

Helper method to set/update the billing & shipping addresses for an order
부터: 2.1
protected set_order_addresses ( WC_Order $order, array $data )
$order WC_Order
$data array

set_order_meta() 보호된 메소드

1) Only non-protected meta (no leading underscore) can be set 2) Meta values must be scalar (int, string, bool)
부터: 2.2
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

set_shipping() 보호된 메소드

Create or update an order shipping method
부터: 2.2
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

update_address() 보호된 메소드

Update address.
protected update_address ( WC_Order $order, array $posted, string $type = 'billing' )
$order WC_Order
$posted array
$type string

프로퍼티 상세

$base 보호되어 있는 프로퍼티

the route base
protected string $base
리턴 string

$post_type 보호되어 있는 프로퍼티

the custom post type
protected string $post_type
리턴 string