How to Restrict WooCommerce Payment Methods Based on Product Types

As a WooCommerce site owner, you know that each payment method has its own pros and cons. Some have lower transaction fees, some work straightforwardly to get rid of disputes and fraud.

That’s why sometimes you might want to hide specific payment gateways and switch to other payment methods to boost conversion and increase your profit.

The article today will shed light on how to restrict WooCommerce payment methods based on product types. The advantages of this practice as well as how to turn this idea into action will be also put forward. Lastly, the top 3 plugins to disable payment methods based on product types will wrap up this post.

When You Should Hide Payment Methods based on Product Types

Let’s say you have a WooCommerce store containing a category that houses premium products. All are subscription products with high prices and premium customer support. You prefer your customers to pay via bank transfer instead of credit cards.

That’s why you need to restrict WooCommerce payment methods based on specific product types and categories.

This is one of the most common practices that is widely used among WooCommerce store owners since it boosts conversion and lowers your transaction fee.

Some payment platforms charge you a high fee for international transactions. Direct bank transfer comes in handy for higher value orders, as it reduces your costs and increases your profits.

What’s more, some payment methods make it easier for customers to request a dispute. Disabling payment methods for certain products allows you to eliminate the risk of paying disputes, which costs more than the original order value. Plus, you can set up other types of payment, such as cheques or credit cards for expensive products to prevent fake orders and fraud.

restrict WooCommerce payment methods on product types

(Image Source: Business Bloomer)

How to Restrict WooCommerce Payment Methods for Specific Category Manually

If you’re tech-savvy, you can restrict WooCommerce payment methods by making use of a custom hooked function in the woocommerce_available_payment_gateways filter hook. This requires you to add a code snippet to your PHP file.

After properly backing up your site, follow this guide to disable WooCommerce payment gateways based on the cart items (product type):

  1. In your WordPress dashboard, head over to the Appearance menu > Theme Editor menu.
  2. Look for the theme function.php file and add the following code to this file
add_filter('woocommerce_available_payment_gateways', 'conditional_payment_gateways', 10, 1);

function conditional_payment_gateways( $available_gateways ) {

// Not in backend (admin)

if( is_admin() )

return $available_gateways;

 

$prod_variable = $prod_simple = $prod_subscription = false;

foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

// Get the WC_Product object

$product = wc_get_product($cart_item['product_id']);

// Get the product types in cart (example)

if($product->is_type('simple')) $prod_simple = true;

if($product->is_type('variable')) $prod_variable = true;

if($product->is_type('subscription')) $prod_subscription = true;

}

// Remove Cash on delivery (cod) payment gateway for simple products

if($prod_simple)

unset($available_gateways['cod']); // unset 'cod'

// Remove Paypal (paypal) payment gateway for variable products

if($prod_variable)

unset($available_gateways['paypal']); // unset 'paypal'

// Remove Bank wire (Bacs) payment gateway for subscription products

if($prod_subscription)

unset($available_gateways['bacs']); // unset 'bacs'

 

return $available_gateways;

}

That’s it!

For others who’d like to get the job done without touching any bit of code, you can seek help from WordPress plugins. There are hundreds of plugins excelling at hiding WooCommerce payment methods. To save you time and effort, we have carried out research and narrowed the list down to the top 3.

Top 3 Plugins to Restrict WooCommerce Payment Methods

#1. WooCommerce Conditional Payment Gateways

WooCommerce Conditional Payment Gateways comes as a trustworthy pick if you want to flexibly restrict WooCommerce payment methods. Not only does it support hiding payment methods by product types, but it also lets you set up restrictions on product height, length, weight, colors, sizes, brands, custom taxonomies, and product attributes, etc.

Along with that, it allows you to activate or deactivate payment gateways based on any cart conditions. The plugin comes with simple yet robust conditional logic, which you can create advanced visibility conditions easily.

On top of that, its intuitive user interface deserves a thumb up. This plug-and-play plugin won’t take you any extra time for setup.

Price: This premium plugin costs you $29 per year for 1 site with a 7-day free trial.

#2. Payment Gateways Per Products/Categories/Tags for WooCommerce

Payment Gateways Per Products for WooCommerce

This free and simple plugin specializes in showing and hiding specific payment gateways for certain products. By and large, it gives you the power to control what payments should be displayed based on the product tag and category.

Payment Gateways Per Products/Categories/Tags for WooCommerce proves a great solver in hiding products or categories that has low profit margins or certain payment gateways with high transaction fees.

Opt for its Pro version if you’d love to have more control over specific products rather than just tags or categories.

Price: Free. The Pro version starts at $19.99 for a single site with a 30-day back guarantee.

#3. WooCommerce Restrict Payment Methods Plugins

WooCommerce Restrict Payment Methods

WooCommerce Restrict Payment Methods enables you to restrict payment methods based on specific products or categories with ease. More than that, you can also use it to hide payment methods depending on custom user roles, cart item quantities, total prices, shipping methods, or countries.

Besides, its user-friendly UI and top-notch customer support have won people’s praise from pole to pole.

Price: $21

Conclusion

This article has guided you through the advantages of hiding payment methods based on product types. It improves conversion, lower your transaction fees, and reduce the risk of paying for dispute.

We’ve also shown you how to restrict WooCommerce payment methods for specific products manually. The top 3 plugins to help you simplify the job without hassle are also brought forward.

Having any questions on this topic? Leave comments below or join our WordPress Facebook group for extra support.