PHP 클래스 WC_API_Coupons

상속: extends WC_API_Resource
파일 보기 프로젝트 열기: woocommerce/woocommerce

보호된 프로퍼티들

프로퍼티 타입 설명
$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