PHP Класс WC_API_Coupons

Наследование: extends WC_API_Resource
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$base string the route base

Открытые методы

Метод Описание
bulk ( array $data ) : array Bulk update or insert coupons Accepts an array with coupons in the formats supported by WC_API_Coupons->create_coupon() and WC_API_Coupons->edit_coupon()
create_coupon ( array $data ) : array Create a coupon
delete_coupon ( integer $id, boolean $force = false ) : array Delete a coupon
edit_coupon ( integer $id, array $data ) : array Edit a coupon
get_coupon ( integer $id, string $fields = null ) : array | WP_Error Get the coupon for the given ID
get_coupon_by_code ( string $code, string $fields = null ) : integer | WP_Error Get the coupon for the given code
get_coupons ( string $fields = null, array $filter = [], integer $page = 1 ) : array Get all coupons
get_coupons_count ( array $filter = [] ) : array Get the total number of coupons
register_routes ( array $routes ) : array Register the routes for this class

Защищенные методы

Метод Описание
get_coupon_expiry_date ( string $expiry_date ) : string expiry_date format

Приватные методы

Метод Описание
query_coupons ( array $args ) : WP_Query Helper method to get coupon post objects

Описание методов

bulk() публичный Метод

Bulk update or insert coupons Accepts an array with coupons in the formats supported by WC_API_Coupons->create_coupon() and WC_API_Coupons->edit_coupon()
С версии: 2.4.0
public bulk ( array $data ) : array
$data array
Результат array

create_coupon() публичный Метод

Create a coupon
С версии: 2.2
public create_coupon ( array $data ) : array
$data array
Результат array

delete_coupon() публичный Метод

Delete a coupon
С версии: 2.2
public delete_coupon ( integer $id, boolean $force = false ) : array
$id integer the coupon ID
$force boolean true to permanently delete coupon, false to move to trash
Результат array

edit_coupon() публичный Метод

Edit a coupon
С версии: 2.2
public edit_coupon ( integer $id, array $data ) : array
$id integer the coupon ID
$data array
Результат array

get_coupon() публичный Метод

Get the coupon for the given ID
С версии: 2.1
public get_coupon ( integer $id, string $fields = null ) : array | WP_Error
$id integer the coupon ID
$fields string fields to include in response
Результат array | WP_Error

get_coupon_by_code() публичный Метод

Get the coupon for the given code
С версии: 2.1
public get_coupon_by_code ( string $code, string $fields = null ) : integer | WP_Error
$code string the coupon code
$fields string fields to include in response
Результат integer | WP_Error

get_coupon_expiry_date() защищенный Метод

expiry_date format
С версии: 2.3.0
protected get_coupon_expiry_date ( string $expiry_date ) : string
$expiry_date string
Результат string

get_coupons() публичный Метод

Get all coupons
С версии: 2.1
public get_coupons ( string $fields = null, array $filter = [], integer $page = 1 ) : array
$fields string
$filter array
$page integer
Результат array

get_coupons_count() публичный Метод

Get the total number of coupons
С версии: 2.1
public get_coupons_count ( array $filter = [] ) : array
$filter array
Результат array

register_routes() публичный Метод

GET /coupons GET /coupons/count GET /coupons/
С версии: 2.1
public register_routes ( array $routes ) : array
$routes array
Результат array

Описание свойств

$base защищенное свойство

the route base
protected string $base
Результат string