Many WooCommerce retailer homeowners make the error of enabling each accessible fee technique. However we’ve realized that having too many fee choices can truly confuse your clients and even result in deserted carts.
Whereas operating WooCommerce shops, we’ve discovered that strategically limiting fee choices can enhance conversion charges and streamline your checkout course of. For instance, you would possibly wish to disable sure fee strategies primarily based on transport places, product varieties, and even order totals.
The excellent news is that you need to use the WooCommerce default settings or a plugin to manage which fee strategies your clients can use. You simply have to know the place to look and which settings to regulate.
On this information, we’ll present you many confirmed methods to disable fee strategies in WooCommerce. We’ll cowl many various situations, whether or not you wish to take away fee choices fully or conditionally disguise them primarily based on particular guidelines.
When to Disable WooCommerce Fee Strategies 💳
Managing fee gateways in WooCommerce isn’t nearly providing as many fee choices as attainable. Typically, that you must limit fee strategies to enhance what you are promoting operations and keep away from excessive transaction charges.
Limiting accessible fee strategies may even enhance the client journey as a result of providing too many selections at checkout will be complicated.
In our expertise, retaining it easy with simply Stripe for bank cards and PayPal works greatest for many worldwide shops.
Nonetheless, if you happen to’re serving particular markets with native fee preferences, you then would possibly want extra management over when and how one can show completely different fee choices.
Listed below are widespread situations while you would possibly wish to have a WooCommerce fee disabled:
- Cart Whole – As an illustration, chances are you’ll require particular fee strategies for bigger orders. This will help cut back transaction prices for fee gateways that cost percentage-based charges. Or, you would possibly disable money on supply for high-value orders.
- Buyer Location – Some fee gateways solely work in particular areas. In that case, chances are you’ll want to cover them from clients who dwell outdoors of these areas. Equally, some cost extra in particular areas, so that you may not wish to supply them in sure areas.
- Person Position – You may arrange fee gateways primarily based on consumer roles, similar to providing wholesale clients completely different fee choices than common patrons. Once more, this may be helpful to scale back transaction charges or threat for orders with greater worth tags.
- Particular Intervals – You would possibly want to alter fee choices throughout vacation gross sales occasions, particularly if these fee strategies may decelerate order processing.
All that mentioned, let’s have a look at 5 other ways you possibly can disable fee gateways in your WooCommerce retailer.
You should utilize the short hyperlinks beneath to skip to your most well-liked technique:
- Choice 1: Disable Fee Strategies Utilizing WooCommerce Settings (For All Clients)
- Choice 2: Set Up Conditional Fee Gateways With a Free Plugin (Simple + Customizable)
- Choice 3: Use Wholesale Suite to Limit Fee Strategies (For Wholesale Clients)
- Choice 4: Use Superior Coupons to Limit Fee Strategies (For Particular Coupons)
- Choice 5: Add Customized Code to Disable Fee Strategies (Superior + No Plugin)
👉 Notice: On this article, we are going to assume that you’ve got already arrange a WooCommerce retailer. In case you need assistance, you possibly can learn our information on how one can begin a web based retailer or our WooCommerce made easy tutorial.
Choice 1: Disable Fee Strategies Utilizing WooCommerce Settings (For All Clients)
WooCommerce truly has built-in settings to disable fee strategies, so that you received’t want to put in a WooCommerce plugin for this strategy. That mentioned, the steps right here will rely somewhat on what you wish to do.
We’ll present you how one can disable your foremost fee strategies, PayPal-specific choices, and Stripe strategies. That means, all of your bases are lined.
Please be aware that we suggest solely following one of many strategies on this part if you wish to fully disable a fee possibility for all clients.
That’s as a result of these strategies don’t mean you can disguise fee choices primarily based on particular standards like consumer roles or product classes.
Disable Your Essential Fee Strategies
You may disable one among your foremost fee strategies (similar to a complete fee gateway or direct financial institution transfers) instantly in your WooCommerce settings.
Merely go to WooCommerce » Settings. Then, navigate to the ‘Funds’ tab. As soon as there, you’ll see all accessible fee gateways in WooCommerce.
We now have enabled the next fee strategies: Stripe for credit score and debit playing cards, direct financial institution switch, verify funds, money on supply, and PayPal.
Right here’s what the checkout appears to be like wish to clients when all of these choices are lively:
To disable a WooCommerce fee, merely click on the toggle change underneath the ‘Enabled’ column for any lively fee technique.
Now, the fee possibility will now not seem in your checkout web page.
In case you determine you wish to allow a few of these fee strategies once more later, you possibly can all the time return to this web page to reactivate them.
Whenever you go to your checkout web page, you must now not see the disabled fee strategies:
Disable PayPal’s Different Fee Strategies
When you have a number of fee strategies enabled through PayPal, then you possibly can simply limit them, too. As an illustration, what you are promoting may not be capable of settle for Venmo funds, so chances are you’ll wish to flip off this feature.
First, you need to use the identical technique we mentioned above.
Go to WooCommerce » Settings » Funds. Then, you possibly can click on the toggle change for any fee technique labeled ‘(through PayPal).’
Alternatively, you possibly can click on the ‘Handle’ button subsequent to the PayPal possibility.
This may take you to the PayPal settings web page.
On the PayPal settings web page, scroll down till you discover the ‘Different Fee Strategies’ part.
Within the ‘Disable Different Fee Strategies’ area, sort within the particular WordPress fee strategies you wish to disguise out of your checkout web page.
When you’ve made your selections, scroll down and click on ‘Save Modifications.’
Now, your chosen fee strategies will likely be disabled.
At this stage, you possibly can go to your checkout web page to see in case your various fee strategies have disappeared.
Right here’s what occurs if we disable the credit score or debit playing cards possibility as a PayPal various fee technique:
👋 Notice: PayPal mechanically reveals location-specific various fee strategies to your clients. For instance, clients within the Netherlands will see iDEAL as a fee possibility, whereas clients in different areas will solely see fee strategies related to their location.
Disable Fee Strategies Enabled by Stripe
When utilizing Stripe as your fee gateway in WooCommerce, it mechanically allows a number of fee choices. These embrace bank cards, debit playing cards, and even some native fee choices primarily based in your area, like Alipay and WeChat.
To enhance the client expertise, you would possibly wish to limit fee strategies to solely these your clients truly use.
This manner, individuals don’t get confused or by accident run into points after selecting a way that received’t work for them.
To do that, go to WooCommerce » Settings » Funds. Then, click on the ‘Handle’ button subsequent to the Stripe possibility.
On the following web page, scroll all the way down to the ‘Funds accepted on checkout’ part.
Right here, you possibly can disable fee strategies by unchecking those you don’t wish to supply.
Stripe affords quite a few fee gateways in WooCommerce, together with Apple Pay, Google Pay, Alipay, Klarna, Affirm, and AfterPay.
Remember to solely allow the particular fee choices that make sense for what you are promoting and your clients.
When you’ve chosen your most well-liked fee strategies, scroll down and click on ‘Save Modifications.’
👋 Notice: Stripe shows fee strategies primarily based in your retailer’s foreign money settings. For instance, SEPA Direct Debit will solely seem as a fee possibility when your retailer is about to make use of EUR (Euro) as its foreign money.
Right here’s what our checkout web page appears to be like like after ACH Direct Debit and Alipay are disabled:
Choice 2: Set Up Conditional Fee Gateways With a Free Plugin (Simple + Customizable)
Have you ever ever needed to point out completely different fee choices to completely different clients? That’s precisely what conditional fee gateways do – they present or disguise fee strategies primarily based on particular “if/then” guidelines.
For instance, you would possibly wish to:
- Disable money on supply for worldwide clients (as a result of this isn’t operationally attainable).
- Disable financial institution transfers for digital merchandise (since this stuff are delivered immediately, this will help stop fraud).
- Disable sure fee choices for bigger orders (to scale back transaction charges).
That is good for companies like worldwide retailers that want completely different fee strategies by nation, luxurious manufacturers that need safe fee choices for high-value purchases, and wholesale shops that provide particular fee phrases for bulk patrons.
The free Disable Fee Methodology for WooCommerce plugin makes organising conditional fee choices simple and free. You may create guidelines primarily based on transport zones, cart totals, consumer roles, time of day, and extra, with out touching any code.
First, that you must set up and activate the plugin. In case you’re new to this course of, take a look at our step-by-step information on how one can set up a WordPress plugin for inexperienced persons.
After you activate the plugin, go to ‘Fee Methodology’ in your WordPress admin space. Then, click on the ‘+ Add disable fee technique rule’ button to start out customizing your WooCommerce fee strategies.
Now, let’s discover the fundamental settings. On the prime, you’ll discover the ‘Standing’ change. This prompts or deactivates every rule to disable fee strategies.
Underneath ‘Rule sort,’ you possibly can select between two choices: disable particular fee strategies or cost further charges for fee processing. For this tutorial, we’ll decide the primary possibility.
That being mentioned, the second possibility is nice if you wish to go processing charges for sure fee strategies – for instance, including a small price for bank card funds.
If you wish to study extra about this, take a look at our information on how one can go fee processing charges to clients in WordPress.
Subsequent, let’s give the rule a descriptive title. Utilizing clear, descriptive names on your fee guidelines makes it simpler to handle a number of conditional fee settings later.
For instance, if you happen to’re disabling Purchase Now Pay Later choices, you would possibly title it ‘Disable BNPL strategies.’
Now, within the ‘Disable this fee strategies*’ field, choose which choices you’d wish to disable.
Within the field beneath that, you can even optionally disable fee strategies for particular currencies, which is nice if you happen to run a multi-currency WooCommerce retailer. This feature is especially helpful for worldwide shops the place sure fee gateways solely work with particular currencies.
In our instance, we’ll disable fee gateways like Klarna, Affirm, and Afterpay, as these are all Purchase Now Pay Later providers.
Transferring down, you’ll discover the part for organising conditional fee guidelines. In ‘Beneath circumstances decide when to disable fee strategies,’ you’ve got two choices.
‘All of the beneath guidelines ought to match’ implies that each situation you set have to be true for the fee technique to be disabled. For instance, if you happen to set circumstances for each cart complete and consumer position, then clients should meet each circumstances earlier than the fee technique disappears.
‘Any one of many beneath rule ought to match’ means the fee technique will likely be disabled when only one situation is met. So, if you happen to set guidelines for both cart complete or consumer position, assembly simply one among these circumstances will disguise the fee possibility.
For this instance, we are going to use the primary possibility.
Now, click on on the ‘Choose situation’ dropdown menu. Right here, you’ll discover a number of classes to create conditional fee guidelines, together with location, product, supply technique, cart complete, date and time, and consumer position.
For instance, let’s arrange a fee gateway for particular cart values. We’ll select ‘Cart Subtotal (Earlier than Low cost)’ from the ‘Cart Associated’ class to disable fee strategies like Purchase Now Pay Later choices when orders exceed a specific amount.
This helps cut back pretend orders and fraud for higher-value purchases in your WooCommerce retailer.
Subsequent, you possibly can select whether or not to disable fee strategies when the situation is:
- Equal to (=)
- Much less or Equal to (<=)
- Lower than (<)
- Better or equal to (>=)
- Better than (>)
- Not equal to (!=)
In our instance, we’ll use ‘Better or equal to’ since we wish to disable sure fee gateways in WooCommerce when orders attain or exceed our threshold quantity.
Lastly, enter your goal worth within the final area.
In our case, we’ll sort in ‘250.’ Which means that when a buyer’s cart reaches $250 or extra, WooCommerce will disable the Purchase Now Pay Later fee strategies we chosen earlier.
One factor we love about this plugin is which you could create complicated conditional fee guidelines by combining a number of circumstances.
For instance, you can limit fee choices primarily based on cart totals and particular dates. This is able to work completely for managing fee strategies throughout vacation gross sales intervals.
So as to add one other situation to your WooCommerce fee guidelines, merely click on the inexperienced ‘Add Situation’ button. After that, observe the identical steps.
Every new situation helps you fine-tune precisely when and the way fee strategies seem in your checkout web page.
When you’re completely satisfied along with your conditional fee guidelines, click on ‘Save Rule.’
The fee strategies you’ve chosen will mechanically be hidden in your WooCommerce checkout when clients meet your specified circumstances.
Now, let’s have a look at a couple of examples of how one can arrange fee gateway guidelines for different enterprise wants:
Disable Money on Supply for Worldwide Clients
Do you promote merchandise internationally and supply money on supply?
In that case, you must disable this fee technique for worldwide clients. This may keep away from fee assortment points and cut back transport dangers.
To do that, you possibly can create a brand new rule and title it one thing like ‘Disable COD for Non-[Country Name] Clients.’ Then, choose ‘Money on supply’ within the fee strategies part.
For the situation, select ‘Nation’ from the situation choices and choose ‘Not Equal to (!=).’
After that, enter your retailer’s nation.
Now, the cash-on-delivery fee technique will solely seem for native clients. On the identical time, it will likely be mechanically hidden for anybody ordering from different nations.
Right here’s how our checkout web page seems when seen as a buyer from Japan:
Disable Financial institution Transfers for Digital Merchandise
Digital merchandise want particular care as a result of they’re delivered straight away, and financial institution transfers will be dangerous on account of gradual processing occasions. Because of this, we suggest disabling this fee possibility on your digital items.
First, make sure that all of your digital merchandise are in the identical class (like ‘Digital merchandise’). In case you haven’t sorted your merchandise but, take a look at our information on how one can add product tags, attributes, and classes in WooCommerce.
Then, create a brand new rule and title it ‘Disable Financial institution Switch for Digital Merchandise.’ Decide ‘Direct financial institution switch’ because the fee technique you wish to disable.
For the situation, you possibly can select ‘Cart has product of class’ from the product choices.
Then, choose your digital merchandise class.
And also you’re accomplished!
Now, when somebody buys an merchandise from the digital product class, they received’t see the financial institution switch possibility at checkout.
Disable Particular Fee Strategies for Giant Orders
When you have ever processed giant orders in your WooCommerce retailer, then you understand that percentage-based fee gateway charges can take an enormous chunk out of your earnings.
For instance, PayPal prices 2.99% + a hard and fast price. On a $1,000 order, that’s round $30 in charges!
So, right here’s how one can arrange conditional fee gateways to supply more cost effective fee choices for high-value purchases.
For this instance, we’ll give attention to PayPal since its percentage-based charges can develop into significantly costly for small enterprise homeowners dealing with giant transactions.
First, create a brand new rule and title it ‘Disable PayPal for Excessive-Worth Orders.’ Choose ‘PayPal’ out of your WooCommerce fee strategies.
In ‘Beneath circumstances decide when to disable fee strategies,’ select ‘Any one of many beneath rule ought to match.’
For the primary situation, that you must decide ‘Cart Subtotal (Earlier than low cost),’ choose ‘Better or equal to,’ and enter ‘1000’ (alter this quantity primarily based in your fee gateway charges).
For the second situation, select ‘Cart amount,’ choose ‘Better than or equal to,’ and enter ’10’ (or no matter quantity is sensible for what you are promoting).
Now, when a buyer’s order meets both situation – spending $1000 or extra, OR ordering 10 or extra objects – PayPal received’t seem as a fee possibility at checkout.
You may place a check order and go to your checkout web page to see if the foundations work:
📌 Searching for easier methods to maximise earnings? Discover ways to get monetary savings with our information on how one can cut back your Stripe processing charges in WordPress.
Choice 3: Use Wholesale Suite to Limit Fee Strategies (For Wholesale Clients)
In case you supply wholesale pricing, you then’ll doubtless wish to set completely different fee gateways primarily based on consumer position. You could wish to supply common clients all the usual fee strategies however restrict them for wholesale clients.
This manner, you possibly can maximize your earnings and reduce any fee safety dangers.
As an illustration, wholesale clients typically make very giant purchases, and sure fee choices (like PayPal) have greater charges. To keep away from these steep charges chopping into earnings, you can disable PayPal for wholesale customers.
Equally, you would possibly flip off Purchase Now Pay Later choices so that you don’t have to attend for an prolonged interval for giant sums of cash (or threat by no means receiving them).
Whilst you can arrange conditional fee gateways utilizing the plugin from Choice 2, wholesale plugins sometimes already embrace this characteristic.
The Wholesale Suite plugin bundle, for instance, has built-in plugins to handle fee strategies primarily based on wholesale consumer roles. This may enhance the client expertise on your B2B patrons.
To get began, go forward and set up these WordPress plugins from the Wholesale Suite in your on-line retailer:
Whereas the Professional model comes with a price ticket, it unlocks important wholesale options, together with fee technique management and tiered pricing.
You may learn our detailed Wholesale Suite overview for extra info.
As soon as each plugins are lively, ensure you have your wholesale retailer fundamentals in place. Listed below are some useful tutorials you possibly can observe:
- Add Wholesale Pricing in WooCommerce (Step by Step)
- Create a Wholesale Order Kind in WordPress
- Cover Costs in WooCommerce (Hold Product Pricing Non-public)
To limit particular fee strategies to wholesale clients, you possibly can go to Wholesale » Settings. Then, choose ‘Fee Gateway.’
Subsequent to ‘Wholesale Position,’ choose the ‘Wholesale Buyer’ position that the plugin has arrange. Then, sort within the fee gateways you wish to allow.
As soon as accomplished, simply click on ‘Add Mapping.’
It’s best to now see the entire enabled fee gateways within the desk beneath.
Like so:
Now, if the consumer logs in as a Wholesale Buyer, they are going to solely see this particular fee technique on their checkout web page.
Right here’s an instance:
Choice 4: Use Superior Coupons to Limit Fee Strategies (For Particular Coupons)
Need to supply rewards for utilizing sure fee strategies?
You are able to do this by creating coupons tied to particular fee choices, which inspires clients to make use of these most well-liked fee strategies.
Whereas the plugin from Choice 2 on this information can deal with this job, coupon plugins like Superior Coupons embrace this characteristic by default. We love this plugin as a result of it helps you to create detailed guidelines and customizations on your payment-specific reductions.
First, that you must set up these WordPress plugins in your WordPress admin space:
The premium model is paid, however you’ll want it to limit fee strategies and create superior coupon guidelines. For extra info, take a look at our full Superior Coupons overview.
Subsequent, arrange your coupons by going to Coupons » Add New.
Then, you possibly can configure your coupon settings nevertheless you want. For detailed directions, learn our step-by-step information on how one can create good coupons in WooCommerce.
For this tutorial, we’ll give attention to creating payment-specific reductions. We’ll create a coupon code known as PAYPAL20 that offers clients a 20% low cost once they select PayPal as their fee technique.
To limit the fee technique for the coupon, scroll down and discover the ‘Fee Strategies Restriction’ tab. Verify the field that claims ‘When checked, will allow fee strategies restriction verify when coupon is utilized.’
For the ‘Kind,’ you need to choose ‘Allowed.’
Then, in ‘Fee Strategies,’ enter PayPal.
After that, be at liberty to proceed organising your coupon. For instance, you possibly can create an auto-apply coupon URL and share it along with your potential clients.
When you’re completed configuring these settings, click on ‘Replace’ or ‘Publish’ to avoid wasting your coupon.
It’s so simple as that!
When clients use this coupon, they’ll see PayPal as the one fee technique.
The low cost will even be utilized to their order abstract.
Choice 5: Add Customized Code to Disable Fee Strategies (Superior + No Plugin)
In case you don’t wish to use a devoted fee plugin, then you can even get the identical outcomes with a number of traces of customized code. We’ll present you how one can disable fee strategies primarily based on two widespread situations: buyer location (nation) and cart complete.
Needless to say this strategy is extra technical than the earlier choices. It requires including code to your features.php file, which controls how your WordPress web site behaves.
Nonetheless, we don’t suggest modifying your features.php file instantly, as making even a small mistake can break your whole web site. As an alternative, we advise utilizing WPCode, which is a code snippet supervisor that helps you add customized code safely.
Whereas it’s a plugin, it’s a light-weight software for a lot of customizations past fee strategies, similar to including monitoring codes, customized features, or analytics.
You may learn our full WPCode overview and our information on the most helpful WordPress code snippets for inexperienced persons to see what you are able to do with WPCode.
Earlier than we begin, we have to know the ID of the fee gateway that we wish to disable. To do that, simply go to WooCommerce » Settings and change to the ‘Funds’ tab.
Then, hover your cursor over one of many fee strategies.
As you do that, take note of the URL preview that seems on the backside of your browser. It ought to look one thing like this: https://instance.com/wp-admin/admin.php?web page=wc-settings&tab=checkout&part=payment-gateway-id
The half on the finish that follows &part=
is your fee gateway ID. So, for instance, if you happen to hover over the PayPal possibility, then the ID is ppcp-gateway
.
Be certain to be aware of this info, as you will want it within the subsequent steps.
Now, set up WPCode in your WordPress web site. You may learn our step-by-step information on how one can set up a WordPress plugin for detailed directions.
Subsequent, go to Code Snippets » + Add Snippet. Then, select ‘Add Your Customized Code (New Snippet)’ and click on on the ‘+ Add Customized Snippet’ button.
After that, you’ll want to decide on a code sort.
For this tutorial, choose ‘PHP Snippet.’
Now, let’s have a look at two code snippets you possibly can add to disable particular fee strategies in WooCommerce.
Disable Fee Strategies Primarily based on Nation
To do that, that you must give your code snippet a reputation like ‘Disable [Payment Method Name] for [Country Name].’
After that, you possibly can paste the code snippet beneath into the ‘Code Preview’ field:
// Hook our customized perform into the WooCommerce accessible fee gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'customize_payment_gateway_based_on_country', 9999 );
perform customize_payment_gateway_based_on_country( $available_gateways ) {
// Verify if we're within the admin space or if the WooCommerce buyer object shouldn't be accessible.
// If both is true, return the unmodified gateways.
if ( is_admin() || ! WC()->buyer ) {
return $available_gateways;
}
// -----------------------------------------------------------------------
// CUSTOMIZATION 1: Fee Gateway ID
//
// Change 'your_gateway_id' with the ID of the fee gateway you wish to goal.
// For instance:
// - To focus on Stripe, exchange with 'stripe'
// - To focus on PayPal, exchange with 'paypal'
//
$gateway_id_placeholder = 'your_gateway_id';
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// CUSTOMIZATION 2: Nation Code
//
// Change 'XX' with the specified nation code the place you wish to disable the gateway.
// Nation codes are primarily based on ISO 3166-1 alpha-2.
// For instance:
// - To focus on america, use 'US'
// - To focus on the UK, use 'GB'
//
$target_country_code = 'XX';
// -----------------------------------------------------------------------
// Verify if the required fee gateway exists throughout the accessible gateways.
if ( isset( $available_gateways[ $gateway_id_placeholder ] ) ) {
// Retrieve the billing nation of the present buyer.
$customer_country = WC()->customer->get_billing_country();
// Examine the client's billing nation with the goal nation code.
if ( $customer_country === $target_country_code ) {
// If the client's nation matches the goal, take away the fee gateway.
unset( $available_gateways[ $gateway_id_placeholder ] );
}
}
// Return the (probably modified) checklist of obtainable gateways.
return $available_gateways;
}
Now, you’ll have to customise two elements of this code.
First, discover the $gateway_id_placeholder
variable and exchange ‘your_gateway_id’ with the ID of your fee gateway.
Discover the $target_country_code
variable and exchange ‘XX’ along with your goal nation’s two-letter code. For instance:
- US – United States
- GB – United Kingdom
- CA – Canada
- AU – Australia
So, let’s say you wish to disable direct financial institution transfers for patrons in america. In that case, then your code ought to appear to be this:
// Hook our customized perform into the WooCommerce accessible fee gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'customize_payment_gateway_based_on_country', 9999 );
perform customize_payment_gateway_based_on_country( $available_gateways ) {
// Verify if we're within the admin space or if the WooCommerce buyer object shouldn't be accessible.
// If both is true, return the unmodified gateways.
if ( is_admin() || ! WC()->buyer ) {
return $available_gateways;
}
// -----------------------------------------------------------------------
// CUSTOMIZATION 1: Fee Gateway ID
//
// Change 'your_gateway_id' with the ID of the fee gateway you wish to goal.
// For instance:
// - To focus on Stripe, exchange with 'stripe'
// - To focus on PayPal, exchange with 'ppcp-gateway'
//
$gateway_id_placeholder = 'bacs';
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// CUSTOMIZATION 2: Nation Code
//
// Change 'XX' with the specified nation code the place you wish to disable the gateway.
// Nation codes are primarily based on ISO 3166-1 alpha-2.
// For instance:
// - To focus on america, use 'US'
// - To focus on the UK, use 'GB'
//
$target_country_code = 'US';
// -----------------------------------------------------------------------
// Verify if the required fee gateway exists throughout the accessible gateways.
if ( isset( $available_gateways[ $gateway_id_placeholder ] ) ) {
// Retrieve the billing nation of the present buyer.
$customer_country = WC()->customer->get_billing_country();
// Examine the client's billing nation with the goal nation code.
if ( $customer_country === $target_country_code ) {
// If the client's nation matches the goal, take away the fee gateway.
unset( $available_gateways[ $gateway_id_placeholder ] );
}
}
// Return the (probably modified) checklist of obtainable gateways.
return $available_gateways;
}
This code will disguise the direct financial institution switch possibility when clients from america go to your checkout web page.
When you’ve custom-made these elements, change the toggle from ‘Inactive’ to ‘Lively,’ then click on ‘Save Snippet.’
Now, you possibly can go forward and place a check order to see if the code works.
Right here’s what our checkout web page appears to be like like after we use the pattern code snippet for disabling PayPal for US-based clients:
Disable Fee Strategies Primarily based on Cart Whole
First, create a brand new code snippet and provides it a descriptive title, like ‘Disable [Payment Method] for Excessive-Worth Orders.’
After that, paste the next code snippet into the ‘Code Preview’ field:
// Hook our customized perform into the WooCommerce accessible fee gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'disable_payment_gateway_for_high_cart_subtotal' );
perform disable_payment_gateway_for_high_cart_subtotal( $available_gateways ) {
// Verify if we're within the admin space. In that case, return the unmodified gateways to keep away from points within the backend.
if ( is_admin() ) {
return $available_gateways;
}
// Get the cart subtotal.
$cart_total = WC()->cart->get_subtotal();
// -----------------------------------------------------------------------
// CUSTOMIZATION 1: Minimal Cart Subtotal
// Change 123 with the specified minimal cart subtotal above which you wish to disable the gateway.
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// CUSTOMIZATION 2: Fee Gateway ID
// Change 'your_gateway_id' with the ID of the fee gateway you wish to goal.
// For instance:
// - To focus on Stripe, exchange with 'stripe'
// - To focus on PayPal, exchange with 'ppcp-gateway'
// -----------------------------------------------------------------------
// Verify if the cart complete meets the minimal and if the required fee gateway is accessible.
if ( $cart_total >= 123 && isset( $available_gateways['your_gateway_id'] ) ) {
// Take away the fee gateway.
unset( $available_gateways['your_gateway_id'] );
}
// Return the (probably modified) checklist of obtainable gateways.
return $available_gateways;
}
You’ll have to customise two elements of this code. First, discover the cart subtotal worth on this line:if ( $cart_total >= 123 && isset( $available_gateways['your_gateway_id'] ) ) {
Merely exchange ‘123’ along with your desired minimal quantity (don’t embrace foreign money symbols).
Subsequent, discover ‘your_gateway_id’ and exchange it along with your fee gateway ID like earlier than.
So, if you wish to disable PayPal for orders over $100, you’d set the worth to ‘100’ and use ‘ppcp-gateway’ because the gateway ID.
Right here’s what the total code snippet would appear to be:
// Hook our customized perform into the WooCommerce accessible fee gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'disable_payment_gateway_for_high_cart_subtotal' );
perform disable_payment_gateway_for_high_cart_subtotal( $available_gateways ) {
// Verify if we're within the admin space. In that case, return the unmodified gateways to keep away from points within the backend.
if ( is_admin() ) {
return $available_gateways;
}
// Get the cart subtotal.
$cart_total = WC()->cart->get_subtotal();
// -----------------------------------------------------------------------
// CUSTOMIZATION 1: Minimal Cart Subtotal
// Change 123 with the specified minimal cart subtotal above which you wish to disable the gateway.
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// CUSTOMIZATION 2: Fee Gateway ID
// Change 'your_gateway_id' with the ID of the fee gateway you wish to goal.
// For instance:
// - To focus on Stripe, exchange with 'stripe'
// - To focus on PayPal, exchange with 'ppcp-gateway'
// -----------------------------------------------------------------------
// Verify if the cart complete meets the minimal and if the required fee gateway is accessible.
if ( $cart_total >= 100 && isset( $available_gateways['ppcp-gateway'] ) ) {
// Take away the fee gateway.
unset( $available_gateways['ppcp-gateway'] );
}
// Return the (probably modified) checklist of obtainable gateways.
return $available_gateways;
}
When you’ve custom-made these elements, change the toggle from ‘Inactive’ to ‘Lively.’
Then, click on ‘Save Snippet.’
Lastly, attempt making a check order to see if the code works.
Right here’s what you must see in your checkout web page if you happen to disable PayPal for orders above $100:
Extra Methods to Enhance Your WooCommerce Retailer
Now that you know the way to handle fee strategies in WooCommerce, listed here are different issues you are able to do to construct a greater on-line retailer:
- Provide supply time slots – Let clients select their most well-liked supply occasions.
- Create product bundles – Group associated objects collectively to spice up your common order worth.
- Use good product search – Add highly effective search options to assist clients discover merchandise rapidly.
- Edit your cart web page – Customise your cart to scale back abandonment and improve gross sales with out code.
- Arrange conversion monitoring – Arrange analytics to know and enhance your retailer’s efficiency.
- Filter WooCommerce merchandise – Add good filters to assist clients discover precisely what they need.
- Redirect to the checkout web page – Skip the cart web page to streamline the WooCommerce checkout course of for patrons.
🚨 Able to take your on-line retailer to the following stage? Let our WPBeginner Professional Companies group assist you construct an expert WooCommerce retailer. We’ll arrange your fee gateways, optimize your checkout course of, and guarantee your retailer runs easily. Plus, you’ll get a devoted challenge supervisor to supervise each element of your retailer setup.
We hope this text has helped you discover ways to disable fee strategies in WooCommerce. You might also wish to take a look at our information on how one can add a free transport bar in WooCommerce and our skilled picks of the greatest Authorize.internet plugins for WordPress.
In case you preferred this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You can too discover us on Twitter and Fb.
The put up Disable Fee Strategies in WooCommerce (Final Information) first appeared on WPBeginner.
Subscribe to MarketingSolution.
Receive web development discounts & web design tutorials.
Now! Lets GROW Together!