By default, WooCommerce displays all active payment gateways to every customer at checkout. But what if you want more control?

For example:

  • You want to disable PayPal for users with the “customer” role.
  • You want to enable bank transfer only for “subscribers”.
  • You want to assign different payment options based on user roles.

Fortunately, WooCommerce is flexible enough to support this with a few lines of code. In this tutorial, we’ll show you how to disable or enable specific payment gateways based on user role using simple PHP snippets.

No need for bulky plugins just clean, efficient code.

Why Disable or Enable Payment Gateways by User Role?

There are plenty of business use cases:

  • B2B stores offering offline payments to wholesale buyers.
  • Subscription sites restricting gateways like Stripe or Razorpay to specific members.
  • Manual order workflows, where only certain user roles should have access to a specific payment method.

With the snippets below, you can easily create customized checkout flows for different user roles.

How It Works

WooCommerce allows you to filter available payment gateways using:

woocommerce_available_payment_gateways

We hook into this filter and use the current user’s role to enable or disable payment methods dynamically.

PHP Snippet 1: Disable a Payment Gateway for a Specific User Role

Let’s say you want to disable PayPal for users with the role customer.

/**
 * Disable PayPal for 'customer' user role at WooCommerce checkout
 */
add_filter( 'woocommerce_available_payment_gateways', 'custom_disable_gateway_for_role' );

function custom_disable_gateway_for_role( $available_gateways ) {
    if ( is_admin() ) return $available_gateways;

    if ( isset( $available_gateways['paypal'] ) && wc_current_user_has_role( 'customer' ) ) {
        unset( $available_gateways['paypal'] );
    }

    return $available_gateways;
}

Explanation:

  • wc_current_user_has_role() checks if the logged-in user has the customer role.
  • If they do, the PayPal gateway (paypal) is removed from the available gateways.

PHP Snippet 2: Enable a Payment Gateway Only for a Specific User Role

This snippet hides the payment gateway from everyone except a specific role. For example, show PayPal only to subscribers.

/**
 * Enable PayPal only for 'subscriber' user role
 */
add_filter( 'woocommerce_available_payment_gateways', 'custom_enable_gateway_for_role' );

function custom_enable_gateway_for_role( $available_gateways ) {
    if ( is_admin() ) return $available_gateways;

    if ( isset( $available_gateways['paypal'] ) && ! wc_current_user_has_role( 'subscriber' ) ) {
        unset( $available_gateways['paypal'] );
    }

    return $available_gateways;
}

How to Find WooCommerce Payment Gateway IDs

Each payment method in WooCommerce has a unique ID such as:

  • PayPal: paypal
  • Bank Transfer: bacs
  • Cash on Delivery: cod
  • Stripe: stripe

How to Find Yours:

  1. Go to WooCommerce > Settings > Payments
  2. Hover over the “Manage” button of the payment method.
  3. Look at the URL:
    If you see &section=bacs, then the ID is bacs.
  4. Or use browser dev tools and inspect the row to find the data-gateway_id attribute.

Prefer Not to Code? Use a Lightweight Plugin Instead

If you’re not comfortable editing PHP or want a user-friendly interface:

Option 1: Mini Plugin – “Toggle Payments by User Role”

  • Built specifically for this task
  • Clean UI with no bloat or ads
  • Set rules: Hide/show gateways per user role
  • Works out of the box, no configuration overload

Option 2: Advanced Plugin – Conditional Payment Gateways

  • Create complex rules (by user role, cart total, country, shipping method, etc.)
  • Great for advanced use cases and large stores

Search for: WooCommerce Conditional Payment Gateways

Conclusion

Customizing WooCommerce payment options by user role is a powerful way to personalize your checkout process. Whether you’re limiting access to certain gateways or enhancing user experience, these code snippets and plugins give you full control without bloating your store.