• I am attempting to keep users from purchasing items twice by using the following code:

    $current_user = wp_get_current_user();
    $email = $current_user->email;
    if ( woocommerce_customer_bought_product( $email, $current_user->ID, $product->id))
       echo 'Purchased';

    However, the $email variable rarely shows the user’s email address, and so often PREVENTS purchases due to some other customer having already purchased the item. Is wp_get_current_user() completely broken? Is there a better command I can use to achieve the same results?

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp_get_current_user() gets a different user’ is closed to new replies.