Class WC_API_Products

WC_API_Resource
Extended by WC_API_Products
Package: WooCommerce\API
Author: WooThemes
Located at includes/api/class-wc-api-products.php

Methods summary

public array
# register_routes( array $routes )

Register the routes for this class

Register the routes for this class

GET /products GET /products/count GET /products/<id> GET /products/<id>/reviews

Parameters

$routes
array
$routes

Returns

array

Since

2.1
public array
# get_products( string $fields = null, string $type = null, array $filter = array(), integer $page = 1 )

Get all products

Get all products

Parameters

$fields
string
$fields
$type
string
$type
$filter
array
$filter
$page
integer
$page

Returns

array

Since

2.1
public array
# get_product( integer $id, string $fields = null )

Get the product for the given ID

Get the product for the given ID

Parameters

$id
integer
$id the product ID
$fields
string
$fields

Returns

array

Since

2.1
public array
# get_products_count( string $type = null, array $filter = array() )

Get the total number of orders

Get the total number of orders

Parameters

$type
string
$type
$filter
array
$filter

Returns

array

Since

2.1
public array
# edit_product( integer $id, array $data )

Edit a product

Edit a product

Parameters

$id
integer
$id the product ID
$data
array
$data

Returns

array

TODO

implement in 2.2
public array
# delete_product( integer $id, boolean $force = false )

Delete a product

Delete a product

Parameters

$id
integer
$id the product ID
$force
boolean
$force true to permanently delete order, false to move to trash

Returns

array

TODO

enable along with PUT/POST in 2.2
public array
# get_product_reviews( integer $id, string $fields = null )

Get the reviews for a product

Get the reviews for a product

Parameters

$id
integer
$id the product ID to get reviews for
$fields
string
$fields fields to include in response

Returns

array

Since

2.1

Methods inherited from WC_API_Resource

__construct(), delete(), filter_response_fields(), is_deletable(), is_editable(), is_readable(), maybe_add_meta(), merge_query_args(), validate_request()

Magic methods summary

Properties summary

protected string $base
#

$base the route base

$base the route base

Properties inherited from WC_API_Resource

$server

WooCommerce API documentation generated by ApiGen 2.8.0