wpgenie icon

mycred - check if enough credits before placing a bid

wpgenie | PRO | 07/23/15 06:53:03 PM UTC | 0 ⭐ | 1315 👁️ | Never ⏰ | []
PHP |

530 B

|

None

|

0 👍

/

0 👎

add_action( 'woocommerce_simple_auctions_before_place_bid','check_influence_before_bid',10,3 );
function check_influence_before_bid($product_id, $bid, $product) {
 
    global $product_data;
 
    $user_id = get_current_user_id();
    $mycred  = mycred();
    $balance = $mycred->get_users_balance( $user_id );
 
    if ( $balance < $bid ) {
        wc_add_notice (sprintf(__('You dont have enough Influence to bid!', 'wc_simple_auctions'), get_permalink(woocommerce_get_page_id('myaccount'))), 'error');
        $product_data = FALSE;
        return false;
    }
}

Comments