Class WC_API_Coupons
-
WC_API_Resource
-
WC_API_Coupons
Methods summary
public
array
|
#
register_routes( array $routes )
Register the routes for this class
Register the routes for this class
GET /coupons GET /coupons/count GET /coupons/<id>
Parameters
Returns
array
Since
2.1
|
public
array
|
#
get_coupons( string $fields = null, array $filter = array(), integer $page = 1 )
Get all coupons
Parameters
- $fields
string $fields
- $filter
array $filter
- $page
integer $page
Returns
array
Since
2.1
|
public
array|WP_Error
|
#
get_coupon( integer $id, string $fields = null )
Get the coupon for the given ID
Get the coupon for the given ID
Parameters
- $id
integer $id the coupon ID
- $fields
string $fields fields to include in response
Returns
array|WP_Error
Since
2.1
|
public
array
|
#
get_coupons_count( array $filter = array() )
Get the total number of coupons
Get the total number of coupons
Parameters
Returns
array
Since
2.1
|
public
integer|WP_Error
|
#
get_coupon_by_code( string $code, string $fields = null )
Get the coupon for the given code
Get the coupon for the given code
Parameters
- $code
string $code the coupon code
- $fields
string $fields fields to include in response
Returns
integer|WP_Error
Since
2.1
|
public
array
|
#
create_coupon( array $data )
Create a coupon
Parameters
Returns
array
TODO
implement in 2.2
|
public
array
|
#
edit_coupon( integer $id, array $data )
Edit a coupon
Parameters
- $id
integer $id the coupon ID
- $data
array $data
Returns
array
TODO
implement in 2.2
|
public
array
|
#
delete_coupon( integer $id, boolean $force = false )
Delete a coupon
Parameters
- $id
integer $id the coupon ID
- $force
boolean $force true to permanently delete coupon, false to move to trash
Returns
array
TODO
enable along with PUT/POST in 2.2
|
__construct()
,
delete()
,
filter_response_fields()
,
is_deletable()
,
is_editable()
,
is_readable()
,
maybe_add_meta()
,
merge_query_args()
,
validate_request()
Magic methods summary
Properties summary
$server