I would like to output for the current logged in user, how many times they have used a specific coupon code.
The coupon code "example_coupon" has a maximum "Usage limit per user" of 12. I would like to display on the front end to the user how many times they have used that coupon, E.G. "Number of coupon uses: 3"
I have this code below running, however, it only shows me the total amount of coupon usage from all users:
function simple_function_1() {
$coupon_code = 'example_coupon';
global $woocommerce;
$coupon_data = new WC_Coupon($coupon_code);
echo ($coupon_data->usage_limit - $coupon_data->usage_count);// return number of remaining coupons
}
add_shortcode( 'own_shortcode1', 'simple_function_1' );
Hope all this makes sense.