WC_Coupon_Data_Store_Interface
in
WC Coupon Data Store Interface
Functions that must be defined by coupon store classes.
Tags
Table of Contents
- decrease_usage_count() : mixed
- Decrease usage count for current coupon.
- get_code_by_id() : string
- Return a coupon code for a specific ID.
- get_ids_by_code() : array<string|int, mixed>
- Return an array of IDs for for a specific coupon code.
- get_usage_by_user_id() : int
- Get the number of uses for a coupon by user ID.
- increase_usage_count() : mixed
- Increase usage count for current coupon.
Methods
decrease_usage_count()
Decrease usage count for current coupon.
public
decrease_usage_count(WC_Coupon &$coupon[, string $used_by = '' ]) : mixed
Parameters
- $coupon : WC_Coupon
-
Coupon object.
- $used_by : string = ''
-
Either user ID or billing email.
Return values
mixed —get_code_by_id()
Return a coupon code for a specific ID.
public
get_code_by_id(int $id) : string
Parameters
- $id : int
-
Coupon ID.
Return values
string — Coupon Code.get_ids_by_code()
Return an array of IDs for for a specific coupon code.
public
get_ids_by_code(string $code) : array<string|int, mixed>
Can return multiple to check for existence.
Parameters
- $code : string
-
Coupon code.
Return values
array<string|int, mixed> — Array of IDs.get_usage_by_user_id()
Get the number of uses for a coupon by user ID.
public
get_usage_by_user_id(WC_Coupon &$coupon, int $user_id) : int
Parameters
- $coupon : WC_Coupon
-
Coupon object.
- $user_id : int
-
User ID.
Return values
int —increase_usage_count()
Increase usage count for current coupon.
public
increase_usage_count(WC_Coupon &$coupon[, string $used_by = '' ]) : mixed
Parameters
- $coupon : WC_Coupon
-
Coupon object.
- $used_by : string = ''
-
Either user ID or billing email.