• Resolved tonygao

    (@tonygao)


    Hello,

    Is there any hook or filter that I can programmly enable the payment gateway to some specific users?

    For example, I only want to let some specific users to buy products by using their points.

Viewing 4 replies - 1 through 4 (of 4 total)
  • A.Tariq

    (@arsalantariq)

    Hi @tonygao,

    Thank you for contacting us, Please use below shared code also do let us know how is it working for you.

    function toggle_mycred_woo_gateway( $gateways ) {
    
    if ( ! is_user_logged_in() ) {
    
        unset( $gateways['mycred'] );
    
        return $gateways;
    
    }
    
    return $gateways;
    }
    add_filter( 'woocommerce_available_payment_gateways', 'toggle_mycred_woo_gateway', 99 );

    @tonygao Note that the above code provided by @arsalantariq will allow users who are logged in to pay for Woocommerce products with points, but will block all non-logged in users from having the option to purchase with points.

    Thread Starter tonygao

    (@tonygao)

    thanks

    A.Tariq

    (@arsalantariq)

    Hi @tonygao,

    Please do let us know if it is working fine for you.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to enable payment gateway to specific user?’ is closed to new replies.