• Resolved kmalber

    (@kmalber)


    Is there a way to restrict Terawallet top-up functionality to only accounts with a negative balance?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @kmalber You can restrict wallet top-ups using filter

    woo_wallet_is_enable_top_up
    Thread Starter kmalber

    (@kmalber)

    Thanks Subrata. In case it helps anyone else, here’s the code I’m using:

    add_filter('woo_wallet_is_enable_top_up',?'ka_limit_topup_to_neg_bal');
    
    function?ka_limit_topup_to_neg_bal($enable_flag){
    
    ????$user?=?wp_get_current_user();??????
    
    ????$current_user_id?=?$user->ID;
    
    ????$wallet_bal?=??woo_wallet()->wallet->get_wallet_balance($current_user_id,?'');?
    
    ????$enable_flag?=?FALSE;????//initialize?to?not?allow?top_up?unless?debit?balance
    
    //?if?a?debit?balance?exists,?allow?payment
    
    ????if?($wallet_bal<0)?{
    
    ????????$enable_flag?=?TRUE;
    
    ????}?
    
    ????return?$enable_flag;????????
    
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘allow terawallet topup conditionally’ is closed to new replies.