PHP Класс WC_Coupon_Data_Store_CPT

Автор: WooThemes
Наследование: extends WC_Data_Store_WP, implements WC_Coupon_Data_Store_Interface, implements WC_Object_Data_Store_Interface
Показать файл Открыть проект

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

Свойство Тип Описание
$internal_meta_keys array Data stored in meta keys, but not considered "meta" for a coupon.
$meta_type string Internal meta type used to store coupon data.

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

Метод Описание
create ( &$coupon ) Method to create a new coupon in the database.
decrease_usage_count ( &$coupon, string $used_by = '' ) Decrease usage count for current coupon.
delete ( &$coupon, array $args = [] ) Deletes a coupon from the database.
get_code_by_id ( integer $id ) : string Return a coupon code for a specific ID.
get_ids_by_code ( string $code ) : array Return an array of IDs for for a specific coupon code.
get_usage_by_user_id ( &$coupon, id $user_id ) : integer Get the number of uses for a coupon by user ID.
increase_usage_count ( &$coupon, string $used_by = '' ) Increase usage count for current coupon.
read ( &$coupon ) Method to read a coupon.
update ( &$coupon ) Updates a coupon in the database.

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

Метод Описание
update_post_meta ( $coupon ) Helper method that updates all the post meta for a coupon based on it's settings in the WC_Coupon class.

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

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

Method to create a new coupon in the database.
С версии: 2.7.0
public create ( &$coupon )

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

Decrease usage count for current coupon.
С версии: 2.7.0
public decrease_usage_count ( &$coupon, string $used_by = '' )
$used_by string Either user ID or billing email

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

Deletes a coupon from the database.
С версии: 2.7.0
public delete ( &$coupon, array $args = [] )
$args array Array of args to pass to the delete method.

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

Return a coupon code for a specific ID.
С версии: 2.7.0
public get_code_by_id ( integer $id ) : string
$id integer
Результат string Coupon Code

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

Can return multiple to check for existence.
С версии: 2.7.0
public get_ids_by_code ( string $code ) : array
$code string
Результат array Array of IDs.

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

Get the number of uses for a coupon by user ID.
С версии: 2.7.0
public get_usage_by_user_id ( &$coupon, id $user_id ) : integer
$user_id id
Результат integer

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

Increase usage count for current coupon.
С версии: 2.7.0
public increase_usage_count ( &$coupon, string $used_by = '' )
$used_by string Either user ID or billing email

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

Method to read a coupon.
С версии: 2.7.0
public read ( &$coupon )

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

Updates a coupon in the database.
С версии: 2.7.0
public update ( &$coupon )

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

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

Data stored in meta keys, but not considered "meta" for a coupon.
С версии: 2.7.0
protected array $internal_meta_keys
Результат array

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

Internal meta type used to store coupon data.
С версии: 2.7.0
protected string $meta_type
Результат string