PHP Class WC_Coupon_Data_Store_CPT

Author: WooThemes
Inheritance: extends WC_Data_Store_WP, implements WC_Coupon_Data_Store_Interface, implements WC_Object_Data_Store_Interface
Afficher le fichier Open project: woocommerce/woocommerce

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

create() public méthode

Method to create a new coupon in the database.
Since: 2.7.0
public create ( &$coupon )

decrease_usage_count() public méthode

Decrease usage count for current coupon.
Since: 2.7.0
public decrease_usage_count ( &$coupon, string $used_by = '' )
$used_by string Either user ID or billing email

delete() public méthode

Deletes a coupon from the database.
Since: 2.7.0
public delete ( &$coupon, array $args = [] )
$args array Array of args to pass to the delete method.

get_code_by_id() public méthode

Return a coupon code for a specific ID.
Since: 2.7.0
public get_code_by_id ( integer $id ) : string
$id integer
Résultat string Coupon Code

get_ids_by_code() public méthode

Can return multiple to check for existence.
Since: 2.7.0
public get_ids_by_code ( string $code ) : array
$code string
Résultat array Array of IDs.

get_usage_by_user_id() public méthode

Get the number of uses for a coupon by user ID.
Since: 2.7.0
public get_usage_by_user_id ( &$coupon, id $user_id ) : integer
$user_id id
Résultat integer

increase_usage_count() public méthode

Increase usage count for current coupon.
Since: 2.7.0
public increase_usage_count ( &$coupon, string $used_by = '' )
$used_by string Either user ID or billing email

read() public méthode

Method to read a coupon.
Since: 2.7.0
public read ( &$coupon )

update() public méthode

Updates a coupon in the database.
Since: 2.7.0
public update ( &$coupon )

Property Details

$internal_meta_keys protected_oe property

Data stored in meta keys, but not considered "meta" for a coupon.
Since: 2.7.0
protected array $internal_meta_keys
Résultat array

$meta_type protected_oe property

Internal meta type used to store coupon data.
Since: 2.7.0
protected string $meta_type
Résultat string