Property | Type | Description | |
---|---|---|---|
$namespace | string | Endpoint namespace. | |
$post_type | string | Post type. | |
$rest_base | string | Route base. |
Method | Description | |
---|---|---|
__construct ( ) | Initialize product actions (parent). | |
add_product_id ( array $args, WP_REST_Request $request ) : array | Adds the parent product ID to the query so we filter / get the correct variations. | |
batch_items ( WP_REST_Request $request ) : array | Bulk create, update and delete items. | |
delete_item ( WP_REST_Request $request ) : WP_Error | boolean | Delete a variation. | |
get_item_schema ( ) : array | Get the Variation's schema, conforming to JSON Schema. | |
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | Prepare a single variation output for response. | |
register_routes ( ) | Register the routes for products. |
Method | Description | |
---|---|---|
add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Add post meta fields. | |
prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | Prepare a single variation for create or update. | |
prepare_links ( $variation, WP_REST_Request $request ) : array | Prepare links for the request. | |
update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Update post meta fields. |
protected add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | |
$request | WP_REST_Request | |
return | boolean | WP_Error |
public add_product_id ( array $args, WP_REST_Request $request ) : array | ||
$args | array | |
$request | WP_REST_Request | |
return | array |
public batch_items ( WP_REST_Request $request ) : array | ||
$request | WP_REST_Request | Full details about the request. |
return | array | Of WP_Error or WP_REST_Response. |
public delete_item ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request |
return | WP_Error | boolean |
public get_item_schema ( ) : array | ||
return | array |
protected prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | ||
$request | WP_REST_Request | Request object. |
return | WP_Error | stdClass | $data Post object. |
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. |
return | WP_REST_Response | $data |
protected prepare_links ( $variation, WP_REST_Request $request ) : array | ||
$request | WP_REST_Request | Request object. |
return | array | Links for the given product. |
protected update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | |
$request | WP_REST_Request | |
return | boolean | WP_Error |