Class WC_API_Coupons

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

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

$routes
array
$routes

Returns

array

Since

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

Get all coupons

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

$filter
array
$filter

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

Create a coupon

Parameters

$data
array
$data

Returns

array

TODO

implement in 2.2
public array
# edit_coupon( integer $id, array $data )

Edit a coupon

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

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

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