Property | Type | Description | |
---|---|---|---|
$namespace | string | Endpoint namespace. | |
$post_type | string | Post type. | |
$rest_base | string | Route base. |
Method | Description | |
---|---|---|
__construct ( ) | Initialize product actions. | |
clear_transients ( WP_Post $post ) | Clear cache/transients. | |
create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Create a single product. | |
delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Delete a single item. | |
get_collection_params ( ) : array | Get the query params for collections of attachments. | |
get_item_schema ( ) : array | Get the Product's schema, conforming to JSON Schema. | |
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | Prepare a single product output for response. | |
query_args ( array $args, WP_REST_Request $request ) : array | Query args. | |
register_routes ( ) | Register the routes for products. | |
save_product ( WP_REST_Request $request ) : integer | Saves a product to the database. | |
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Update a single product. |
Method | Description | |
---|---|---|
add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Add post meta fields. | |
delete_post ( integer | WP_Post $id ) | Delete post. | |
get_attribute_options ( integer $product_id, array $attribute ) : array | Get attribute options. | |
get_attribute_taxonomy_label ( string $name ) : string | Get attribute taxonomy label. | |
get_attributes ( WC_Product | WC_Product_Variation $product ) : array | Get the attributes for a product or product variation. | |
get_default_attributes ( WC_Product $product ) : array | Get default attributes. | |
get_downloads ( WC_Product | WC_Product_Variation $product ) : array | Get the downloads for a product or product variation. | |
get_images ( WC_Product | WC_Product_Variation $product ) : array | Get the images for a product or product variation. | |
get_product_data ( WC_Product $product ) : array | Get product data. | |
get_taxonomy_terms ( WC_Product $product, string $taxonomy = 'cat' ) : array | Get taxonomy terms. | |
get_variation_data ( WC_Product $product ) : array | Get an individual variation's data. | |
prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | Prepare a single product for create or update. | |
prepare_links ( WC_Product $product, WP_REST_Request $request ) : array | Prepare links for the request. | |
save_default_attributes ( WC_Product $product, WP_REST_Request $request ) : WC_Product | Save default attributes. | |
save_product_images ( WC_Product $product, array $images ) : WC_Product | Save product images. | |
save_product_meta ( WC_Product $product, WP_REST_Request $request ) : WC_Product | Save product meta. | |
save_taxonomy_terms ( WC_Product $product, array $terms, string $taxonomy = 'cat' ) : WC_Product | Save taxonomy terms. | |
save_variations_data ( WC_Product $product, WP_REST_Request $request, boolean $single_variation = false ) : boolean | Save variations. | |
update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Update post meta fields. |
Method | Description | |
---|---|---|
save_downloadable_files ( WC_Product $product, array $downloads, integer $deprecated ) : WC_Product | Save downloadable files. | |
save_product_shipping_data ( WC_Product $product, array $data ) : WC_Product | Save product shipping data. |
protected add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | Post data. |
$request | WP_REST_Request | Request data. |
return | boolean | WP_Error |
public clear_transients ( WP_Post $post ) | ||
$post | WP_Post | Post data. |
public create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response |
public delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error |
protected delete_post ( integer | WP_Post $id ) | ||
$id | integer | WP_Post | Post ID or WP_Post instance. |
protected get_attribute_taxonomy_label ( string $name ) : string | ||
$name | string | Taxonomy name. |
return | string |
protected get_attributes ( WC_Product | WC_Product_Variation $product ) : array | ||
$product | WC_Product | WC_Product_Variation | Product instance. |
return | array |
public get_collection_params ( ) : array | ||
return | array |
protected get_default_attributes ( WC_Product $product ) : array | ||
$product | WC_Product | Product instance. |
return | array |
protected get_downloads ( WC_Product | WC_Product_Variation $product ) : array | ||
$product | WC_Product | WC_Product_Variation | Product instance. |
return | array |
protected get_images ( WC_Product | WC_Product_Variation $product ) : array | ||
$product | WC_Product | WC_Product_Variation | Product instance. |
return | array |
public get_item_schema ( ) : array | ||
return | array |
protected get_product_data ( WC_Product $product ) : array | ||
$product | WC_Product | Product instance. |
return | array |
protected get_taxonomy_terms ( WC_Product $product, string $taxonomy = 'cat' ) : array | ||
$product | WC_Product | Product instance. |
$taxonomy | string | Taxonomy slug. |
return | array |
protected get_variation_data ( WC_Product $product ) : array | ||
$product | WC_Product | Product instance. |
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 |
protected prepare_links ( WC_Product $product, WP_REST_Request $request ) : array | ||
$product | WC_Product | Product object. |
$request | WP_REST_Request | Request object. |
return | array | Links for the given product. |
public query_args ( array $args, WP_REST_Request $request ) : array | ||
$args | array | Request args. |
$request | WP_REST_Request | Request data. |
return | array |
protected save_default_attributes ( WC_Product $product, WP_REST_Request $request ) : WC_Product | ||
$product | WC_Product | Product instance. |
$request | WP_REST_Request | Request data. |
return | WC_Product |
public save_product ( WP_REST_Request $request ) : integer | ||
$request | WP_REST_Request | Full details about the request. |
return | integer |
protected save_product_images ( WC_Product $product, array $images ) : WC_Product | ||
$product | WC_Product | Product instance. |
$images | array | Images data. |
return | WC_Product |
protected save_product_meta ( WC_Product $product, WP_REST_Request $request ) : WC_Product | ||
$product | WC_Product | Product instance. |
$request | WP_REST_Request | Request data. |
return | WC_Product |
protected save_taxonomy_terms ( WC_Product $product, array $terms, string $taxonomy = 'cat' ) : WC_Product | ||
$product | WC_Product | Product instance. |
$terms | array | Terms data. |
$taxonomy | string | Taxonomy name. |
return | WC_Product |
protected save_variations_data ( WC_Product $product, WP_REST_Request $request, boolean $single_variation = false ) : boolean | ||
$product | WC_Product | Product instance. |
$request | WP_REST_Request | Request data. |
$single_variation | boolean | True if saving only a single variation. |
return | boolean |
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response |
protected update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | Post data. |
$request | WP_REST_Request | Request data. |
return | boolean | WP_Error |