• Resolved isabelk2j

    (@isabelk2j)


    Good Day and thanks so much for this wonderful plugin. I want to ask if it is possible to automatically credit a user a certain amount upon registration. i.e when a user is registered a default amount should be added to the wallet? is there a code available to do this if not currently available on the plugin.

    Thanks in advance for your response

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

    (@subratamal)

    @isabelk2j,
    Please use
    woo_wallet()->wallet->credit($user_id, $amount, $details); when a new user register to the system(You can see https://developer.www.ads-software.com/reference/hooks/user_register/).

    Thread Starter isabelk2j

    (@isabelk2j)

    Thanks so much, I really appreciate it … I have another issue because I have built my website based on your plugin and I’m really loving it … I want to be able to refund users who uses their wallet cash for payment if WooCommerce order fails. Where is the setting for refund if order fails

    Thanks so Much for your quick response and if you want me to make this issue a new topic I can do that.

    Thanks
    Izzy

    Thread Starter isabelk2j

    (@isabelk2j)

    Regarding the auto-crediting

    
    function anyfunction_name($user_id) {
       woo_wallet()->wallet->credit($user_id, $amount, $details);
    }
    do_action('user_register', 'anyfunction_name', $user_id);
    
    

    Is this the correct way to write it, sorry I’m new to this, please correct me if I’m wrong. ??

    Thread Starter isabelk2j

    (@isabelk2j)

    Please respond to

    “Regarding the auto-crediting

    
    function anyfunction_name($user_id) {
       woo_wallet()->wallet->credit($user_id, $amount, $details);
    }
    do_action('user_register', 'anyfunction_name', $user_id);
    
    

    Is this the correct way to write it, sorry I’m new to this, please correct me if I’m wrong. :)”

    Thanks.

    Plugin Author Subrata Mal

    (@subratamal)

    @isabelk2j,

    The above code has an error please use below code.

    add_action('user_register', 'user_register_callback');
    function user_register_callback($user_id){
        $amount = 50;
        woo_wallet()->wallet->credit($user_id, $amount, 'New user registration');
    }
    Thread Starter isabelk2j

    (@isabelk2j)

    You are the best

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Auto Credit User Upon Registration’ is closed to new replies.