PHP 클래스 WC_REST_Orders_Controller

상속: extends WC_REST_Posts_Controller
파일 보기 프로젝트 열기: woocommerce/woocommerce 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$namespace string Endpoint namespace.
$post_type string Post type.
$request array Stores the request.
$rest_base string Route base.

공개 메소드들

메소드 설명
__construct ( ) Initialize orders actions.
create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Create a single item.
get_collection_params ( ) : array Get the query params for collections.
get_item_schema ( ) : array Get the Order's schema, conforming to JSON Schema.
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response Prepare a single order output for response.
query_args ( array $args, WP_REST_Request $request ) : array Query args.
register_routes ( ) Register the routes for orders.
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Update a single order.

보호된 메소드들

메소드 설명
create_base_order ( array $data ) : WC_Order Create base WC Order object.
create_order ( WP_REST_Request $request ) : integer | WP_Error Create order.
filter_writable_props ( array $schema ) : boolean Only reutrn writeable props from schema.
get_order_item_data ( WC_Order_item $item ) : array Expands an order item to get its data.
get_order_statuses ( ) : array Get order statuses without prefixes.
get_product_id ( array $posted ) : integer Gets the product ID from the SKU or posted ID.
item_is_null ( array $item ) : boolean Helper method to check if the resource ID associated with the provided item is null.
maybe_set_item_prop ( WC_Order_Item $item, string $prop, array $posted ) Maybe set an item prop if the value was posted.
maybe_set_item_props ( WC_Order_Item $item, string[] $props, array $posted ) Maybe set item props if the values were posted.
prepare_coupon_lines ( array $posted, string $action ) Create or update an order coupon.
prepare_fee_lines ( array $posted, string $action ) Create or update an order fee.
prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | WC_Order Prepare a single order for create.
prepare_line_items ( array $posted, string $action = 'create' ) Create or update a line item.
prepare_links ( WC_Order $order, WP_REST_Request $request ) : array Prepare links for the request.
prepare_shipping_lines ( $posted, string $action ) Create or update an order shipping method.
set_item ( WC_Order $order, string $item_type, array $posted ) Wrapper method to create/update order items.
update_address ( WC_Order $order, array $posted, string $type = 'billing' ) Update address.
update_order ( WP_REST_Request $request ) : integer | WP_Error Update order.

메소드 상세

__construct() 공개 메소드

Initialize orders actions.
public __construct ( )

create_base_order() 보호된 메소드

Create base WC Order object.
사용 중단: 2.7.0
protected create_base_order ( array $data ) : WC_Order
$data array
리턴 WC_Order

create_item() 공개 메소드

Create a single item.
public create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response

create_order() 보호된 메소드

Create order.
protected create_order ( WP_REST_Request $request ) : integer | WP_Error
$request WP_REST_Request Full details about the request.
리턴 integer | WP_Error

filter_writable_props() 보호된 메소드

Only reutrn writeable props from schema.
protected filter_writable_props ( array $schema ) : boolean
$schema array
리턴 boolean

get_collection_params() 공개 메소드

Get the query params for collections.
public get_collection_params ( ) : array
리턴 array

get_item_schema() 공개 메소드

Get the Order's schema, conforming to JSON Schema.
public get_item_schema ( ) : array
리턴 array

get_order_item_data() 보호된 메소드

Expands an order item to get its data.
protected get_order_item_data ( WC_Order_item $item ) : array
$item WC_Order_item
리턴 array

get_order_statuses() 보호된 메소드

Get order statuses without prefixes.
protected get_order_statuses ( ) : array
리턴 array

get_product_id() 보호된 메소드

Gets the product ID from the SKU or posted ID.
protected get_product_id ( array $posted ) : integer
$posted array Request data
리턴 integer

item_is_null() 보호된 메소드

Items can be deleted by setting the resource ID to null.
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.

maybe_set_item_prop() 보호된 메소드

Maybe set an item prop if the value was posted.
protected maybe_set_item_prop ( WC_Order_Item $item, string $prop, array $posted )
$item WC_Order_Item
$prop string
$posted array Request data.

maybe_set_item_props() 보호된 메소드

Maybe set item props if the values were posted.
protected maybe_set_item_props ( WC_Order_Item $item, string[] $props, array $posted )
$item WC_Order_Item
$props string[]
$posted array Request data.

prepare_coupon_lines() 보호된 메소드

Create or update an order coupon.
protected prepare_coupon_lines ( array $posted, string $action )
$posted array Item data.
$action string 'create' to add coupon or 'update' to update it.

prepare_fee_lines() 보호된 메소드

Create or update an order fee.
protected prepare_fee_lines ( array $posted, string $action )
$posted array Item data.
$action string 'create' to add fee or 'update' to update it.

prepare_item_for_database() 보호된 메소드

Prepare a single order for create.
protected prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | WC_Order
$request WP_REST_Request Request object.
리턴 WP_Error | WC_Order $data Object.

prepare_item_for_response() 공개 메소드

Prepare a single order output for response.
public prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response
$post WP_Post Post object.
$request WP_REST_Request Request object.
리턴 WP_REST_Response $data

prepare_line_items() 보호된 메소드

Create or update a line item.
protected prepare_line_items ( array $posted, string $action = 'create' )
$posted array Line item data.
$action string 'create' to add line item or 'update' to update it.

prepare_shipping_lines() 보호된 메소드

Create or update an order shipping method.
protected prepare_shipping_lines ( $posted, string $action )
$posted $shipping Item data.
$action string 'create' to add shipping or 'update' to update it.

query_args() 공개 메소드

Query args.
public query_args ( array $args, WP_REST_Request $request ) : array
$args array
$request WP_REST_Request
리턴 array

register_routes() 공개 메소드

Register the routes for orders.
public register_routes ( )

set_item() 보호된 메소드

When updating, the item ID provided is checked to ensure it is associated with the order.
protected set_item ( WC_Order $order, string $item_type, array $posted )
$order WC_Order order
$item_type string
$posted array item provided in the request body

update_address() 보호된 메소드

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

update_item() 공개 메소드

Update a single order.
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response

update_order() 보호된 메소드

Update order.
protected update_order ( WP_REST_Request $request ) : integer | WP_Error
$request WP_REST_Request Full details about the request.
리턴 integer | WP_Error

프로퍼티 상세

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

Endpoint namespace.
protected string $namespace
리턴 string

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

Post type.
protected string $post_type
리턴 string

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

Stores the request.
protected array $request
리턴 array

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

Route base.
protected string $rest_base
리턴 string