mycred_get_global_coupon_count

Description

This function returns the total number of times a given coupon has been redeemed on your website.

This function is only available if the Coupons add-on is enabled.

Available since version 1.4

Returns

(int) The total number of times the coupon has been used.

Parameters

Param Type Required Description
function mycred_get_global_coupon_count(
$coupon_post_id int Yes

The coupon post object ID.

) { ... }

Examples

Example 1: Count the number of times a coupon has been used.

$coupon_id = 1;
$count     = mycred_get_global_coupon_count( $coupon_id );

printf( 'The coupon %s has been used %d times.', get_the_title( $coupon_id ), $count );