How to Remove WooCommerce Payment Options From Checkout

WooCommerce Remove Payment Options From Checkout

WooCommerce is a powerful WordPress plugin that allows you to sell products or services.

However, there are chances you do not want your customers to use a particular payment method or any payment options at all on your checkout page. How do you go about this?

WooCommerce Remove Payment Options From Checkout

This brief tutorial will show you an easy solution to remove a certain payment method and remove all payment options without breaking your site.

Additionally, I will share a custom PHP code snippet that I created for disabling a payment gateway for a specific user role on the WooCommerce checkout page. For example, you may want to disable PayPal for the shop manager role.

Steps to Change a Specific Payment Method on the Checkout Page

By default, this is how WooCommerce payment gateways are arranged on the checkout page:WooCommerce is a powerful WordPress plugin that allows you to sell products or services. However, there are chances you do not want your customers to use a particular payment method or any payment options at all on your checkout page. How do you go about this? WooCommerce remove Payment Options from the Checkout Page This brief tutorial will show you an easy solution to remove a certain payment method and remove all payment options without breaking your site. Additionally, I will share a custom PHP code snippet that I created for disabling a payment gateway for a specific user role on the WooCommerce checkout page. For example, you may want to disable PayPal for the shop manager role. Steps to Change a Specific Payment Method on Checkout Page By default, this is how WooCommerce payment gateways are arranged on the checkout page: The next step now is to remove a specific payment method. For illustration purposes, I will remove the direct bank transfer payment method. Here are the steps that you need to follow: 1. Log into your WordPress site and access the dashboard as the admin user 2. Click the Settings link under the WooCommerce menu. 3. Click on the Payments tab. You will see all the payment methods and their settings. 4. To remove the direct bank transfer payment method, uncheck the button on the Enabled column as shown below: 5. With this simple method, you can easily disable any payment gateway of your choice. Once you are done, remember to save the changes. 6. After that, go straight to the front end of your site, and refresh the checkout page. You will notice that the direct bank transfer payment gateway does not appear on the checkout page: Steps to Remove All Payment Methods on the Checkout Page This solution involves the use of a custom PHP code snippet. Here are the steps that you need to follow: 1. Log into your WordPress site and access the dashboard as the admin user 2. From the dashboard menu, click on the Appearance Menu > Theme Editor Menu. When the theme editor page is opened, look for the theme functions file with the extension functions.php. Open this functions file to add the function to remove all payment gateways on the checkout page. 3. Add the following line of code to the functions.php file: // Disable all payment gateways on the checkout page and replace the "Pay" button with "Place order". add_filter( 'woocommerce_cart_needs_payment', '__return_false' ); 4. This is the outcome: 5. Alternatively, you can disable a specific payment gateway for a specific user role. For example, the following code snippet will disable the PayPal payment option for the shop manager role. You should add it in the functions.php file: /** * Disable Payment Gateway for a Specific User Role | WooCommerce */ add_filter( 'woocommerce_available_payment_gateways', 'njengah_paypal_disable_manager' ); function njengah_paypal_disable_manager( $available_gateways ) { if ( isset( $available_gateways['paypal'] ) && current_user_can( 'manage_woocommerce' ) ) { unset( $available_gateways['paypal'] ); } return $available_gateways; } Conclusion In this post, you have seen how you can disable any payment gateway using the built-in WooCommerce option. However, if you are tech-savvy, you can use the custom PHP scripts I have shared. If you want to hide a specific payment gateway using PHP, remember to add the correct payment gateway ID. If you are not able to add the code correctly, please consider hiring a WordPress developer.

The next step now is to remove a specific payment method.

For illustration purposes, I will remove the direct bank transfer payment method.

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the dashboard as the admin user.
  2. Click the Settings link under WooCommerce.
  3. Click on the Payments tab. You will see all the payment methods and their settings.
  4. To remove the direct bank transfer payment method, uncheck the button on the Enabled column as shown below:disable bank transfer payment
  5. With this simple method, you can easily disable any payment gateway of your choice. Once you are done, remember to save the changes.
  6. After that, go straight to the front end of your site, and refresh the checkout page. You will notice that the direct bank transfer payment gateway does not appear on the checkout page:disable payment method

Steps to Remove All Payment Methods on the Checkout Page

This solution involves the use of a custom PHP code snippet. Here are the steps that you need to follow:

  1. Log into your WordPress site and access the dashboard as the admin user.
  2. From the dashboard menu, click on the Appearance Menu > Theme Editor Menu. When the theme editor page is opened, look for the theme functions file with the extension functions.php. Open this functions file to add the function to remove all payment gateways on the checkout page.
  3. Add the following line of code to the functions.php file:
// Disable all payment gateways on the checkout page and replace the "Pay" button with "Place order".

add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
  1. This is the outcome:disable all payment gateways
  2. Alternatively, you can disable a specific payment gateway for a specific user role. For example, the following code snippet will disable the PayPal payment option for the shop manager role. You should add it in the functions.php file:
/**

*        Disable Payment Gateway for a Specific User Role | WooCommerce

*/

add_filter( 'woocommerce_available_payment_gateways', 'njengah_paypal_disable_manager' );

function njengah_paypal_disable_manager( $available_gateways ) {

if ( isset( $available_gateways['paypal'] ) && current_user_can( 'manage_woocommerce' ) ) {

unset( $available_gateways['paypal'] );

}

return $available_gateways;

}

Conclusion

In this post, you have seen how you can disable any payment gateway using the built-in WooCommerce option. However, if you are tech-savvy, you can use the custom PHP scripts I have shared.

If you want to hide a specific payment gateway using PHP, remember to add the correct payment gateway ID. If you are not able to add the code correctly, please consider hiring a WordPress developer.

Similar Articles