Class WC_Coupon
WooCommerce coupons
The WooCommerce coupons class gets coupon data from storage and checks coupon validity
Package: WooCommerce\Classes
Category: Class
Author: WooThemes
Class: WC_Coupon
Located at includes/class-wc-coupon.php
Category: Class
Author: WooThemes
Class: WC_Coupon
Located at includes/class-wc-coupon.php
Methods summary
public
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
|
|
public
|
|
public
string
|
|
public
boolean|WP_Error
|
|
public
boolean
|
|
public
boolean
|
|
public
float
|
#
get_discount_amount( float $discounting_amount, array|null $cart_item = null, boolean $single = false )
Get discount amount for a cart item |
public
|
#
add_coupon_message( integer $msg_code )
Converts one of the WC_Coupon message/error codes to a message string and displays the message/error. |
public
string|
|
|
public
string|
|
|
public static
string|
|
#
get_generic_coupon_error( integer $err_code )
Map one of the WC_Coupon error codes to an error string No coupon instance will be available where a coupon does not exist, so this static method exists. |
Magic methods summary
Constants summary
integer |
E_WC_COUPON_INVALID_FILTERED
|
100 |
|
integer |
E_WC_COUPON_INVALID_REMOVED
|
101 |
|
integer |
E_WC_COUPON_NOT_YOURS_REMOVED
|
102 |
|
integer |
E_WC_COUPON_ALREADY_APPLIED
|
103 |
|
integer |
E_WC_COUPON_ALREADY_APPLIED_INDIV_USE_ONLY
|
104 |
|
integer |
E_WC_COUPON_NOT_EXIST
|
105 |
|
integer |
E_WC_COUPON_USAGE_LIMIT_REACHED
|
106 |
|
integer |
E_WC_COUPON_EXPIRED
|
107 |
|
integer |
E_WC_COUPON_MIN_SPEND_LIMIT_NOT_MET
|
108 |
|
integer |
E_WC_COUPON_NOT_APPLICABLE
|
109 |
|
integer |
E_WC_COUPON_NOT_VALID_SALE_ITEMS
|
110 |
|
integer |
E_WC_COUPON_PLEASE_ENTER
|
111 |
|
integer |
WC_COUPON_SUCCESS
|
200 |
|
integer |
WC_COUPON_REMOVED
|
201 |
Properties summary
public
mixed
|
$code | |
public
mixed
|
$id | |
public
mixed
|
$type | |
public
mixed
|
$discount_type | |
public
mixed
|
$amount | |
public
mixed
|
$individual_use | |
public
mixed
|
$product_ids | |
public
mixed
|
$usage_limit | |
public
mixed
|
$usage_limit_per_user | |
public
mixed
|
$limit_usage_to_x_items | |
public
mixed
|
$usage_count | |
public
mixed
|
$expiry_date | |
public
mixed
|
$apply_before_tax | |
public
mixed
|
$free_shipping | |
public
mixed
|
$product_categories | |
public
mixed
|
$exclude_product_categories | |
public
mixed
|
$exclude_sale_items | |
public
mixed
|
$minimum_amount | |
public
mixed
|
$customer_email | |
public
mixed
|
$coupon_custom_fields | |
public
mixed
|
$coupon_amount | |
public
mixed
|
$error_message |