How to display a specific payment method for logged in users only in Woocommerce?

In this tutorial we’ll learn how to display a specific payment option for logged in users only.

First of all let’s have a look at our checkout page, what payment methods are being displayed initially.

To do this add some items in cart and go to cart then proceed to checkout.

Here is the default checkout screen:


Here you can see three payment methods enabled. Now let’s say we want to display cheque payment method only for logged in users.

To do this add the following lines of code at the end of your theme’s functions.php file:

function rp_filter_gateways( $args ) {

if( !is_user_logged_in() && isset($args['cheque']) ) {

unset( $args['cheque'] );


return $args;


add_action( 'woocommerce_available_payment_gateways', 'rp_filter_gateways' );

You can access functions.php file here:


Save the file after that.

Now if you go to checkout page again and if you are not logged in, you’ll not see cheque payment option.


But the cheque payment option will still be displayed for logged in customers.


In the same way you can remove other payment methods as well.


Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

Leave a Reply

Your email address will not be published. Required fields are marked *