How one can Disable Fee Strategies in WooCommerce (Final Information)

by | Mar 27, 2025 | Etcetera | 0 comments

Many WooCommerce store householders make the mistake of enabling each available value means. On the other hand we’ve came upon that having too many value possible choices can in fact confuse your consumers and even lead to abandoned carts.

While working WooCommerce shops, we’ve came upon that strategically limiting value possible choices can enhance conversion fees and streamline your checkout process. For instance, it’s possible you’ll want to disable certain value methods in step with shipping puts, product sorts, or even order totals.

The good news is that you just’ll be capable of use the WooCommerce default settings or a plugin to regulate which value methods your consumers can use. You merely want to know where to look and which settings to keep an eye on.

In this knowledge, we’ll show you several showed ways to disable value methods in WooCommerce. We’ll cover many quite a lot of scenarios, whether or not or now not you wish to have to remove value possible choices completely or conditionally hide them in step with specific rules.

How to Disable Payment Methods in WooCommerce

When to Disable WooCommerce Price Methods 💳

Managing value gateways in WooCommerce isn’t on the subject of offering as many value possible choices as possible. Every now and then, you want to restrict value simple how to enhance your corporation operations and keep away from over the top transaction fees.

Limiting available value methods will even enhance the consumer journey because of offering too many imaginable possible choices at checkout will also be difficult.

In our enjoy, retaining it simple with merely Stripe for credit cards and PayPal works perfect for lots of international shops.

However, if you happen to occur to’re serving specific markets with local value preferences, then you might have considered trying further regulate over when and recommendations on methods to display different value possible choices.

Indexed right here don’t seem to be ordinary scenarios while you might want to have a WooCommerce value disabled:

  • Cart General – For instance, you must require specific value methods for higher orders. It’s going to have the same opinion reduce transaction costs for value gateways that price percentage-based fees. Or, it’s possible you’ll disable cash on shipping for high-value orders.
  • Purchaser Location – Some value gateways only art work particularly spaces. If that’s the case, you must want to hide them from consumers who’re residing outdoor of those areas. Similarly, some price further particularly spaces, so it’s possible you’ll not want to offer them in certain spaces.
  • Shopper Place – You’ll be capable of prepare value gateways in step with client roles, very similar to offering wholesale consumers different value possible choices than not unusual consumers. Another time, this will also be useful to reduce transaction fees or probability for orders with larger price tags.
  • Specific Categories – You might want to trade value possible choices far and wide vacation gross sales occasions, in particular if those value methods might slow down order processing.

All that said, let’s take a look at 5 different ways you’ll be capable of disable value gateways for your WooCommerce store.

You’ll be capable of use the short links beneath to skip for your hottest means:

👉 Phrase: In this article, we can assume that you just’ve were given already prepare a WooCommerce store. If you want to have have the same opinion, you’ll be capable of be informed our knowledge on tips on how to get started a web based retailer or our WooCommerce made easy educational.

Selection 1: Disable Price Methods The usage of WooCommerce Settings (For All Consumers)

WooCommerce in fact has built-in settings to disable value methods, in order that you won’t want to arrange a WooCommerce plugin for this implies. That said, the steps proper right here will depend quite on what you wish to have to do.

We’ll show you recommendations on methods to disable your number one value methods, PayPal-specific possible choices, and Stripe methods. That suggests, your entire bases are covered.

Please phrase that we recommend only following one of the vital necessary methods in this section if you want to completely disable a worth chance for all consumers.

That’s because of the ones methods don’t mean you can hide value possible choices in step with specific requirements like client roles or product categories.

How you can Disable Your Number one Price Methods

You’ll be capable of disable one amongst your number one value methods (very similar to a complete value gateway or direct monetary establishment transfers) immediately for your WooCommerce settings.

Simply move to WooCommerce » Settings. Then, navigate to the ‘Expenses’ tab. Once there, you’ll see all available price gateways in WooCommerce.

Configuring the WooCommerce payments settings

We’ve were given enabled the following value methods: Stripe for credit score ranking and debit taking part in playing cards, direct monetary establishment transfer, check out expenses, cash on shipping, and PayPal.

Proper right here’s what the checkout seems like to consumers when the entire ones possible choices are vigorous:

Active payment methods in WooCommerce checkout

To disable a WooCommerce value, simply click on at the toggle switch underneath the ‘Enabled’ column for any vigorous value means.

Now, the fee chance is not going to appear on your checkout internet web page.

Disabling payment methods in WooCommerce

If you make a decision you wish to have to permit among the ones value methods all over again later, you’ll be capable of always return to this internet web page to reactivate them.

Whilst you seek advice from your checkout internet web page, you’ll have to now not see the disabled value methods:

What the WooCommerce checkout page looks like after some payment options are disabled

How you can Disable PayPal’s Selection Price Methods

You probably have a couple of value methods enabled by means of PayPal, you then’ll be capable of merely restrict them, too. For instance, your corporation might not be able to settle for Venmo bills, so you must want to turn off this option.

PayPal payment options

First, you’ll be capable of use the identical means we discussed above.

Transfer to WooCommerce » Settings » Expenses. Then, you’ll be capable of click on at the toggle switch for any value means labeled ‘(by means of PayPal).’

Disabling PayPal's alternative payment methods

Alternatively, you’ll be capable of click on at the ‘Arrange’ button next to the PayPal chance.

This may occasionally take you to the PayPal settings internet web page.

Managing PayPal for WooCommerce settings

On the PayPal settings internet web page, scroll down until you in finding the ‘Selection Price Methods’ section.

Inside the ‘Disable Selection Price Methods’ field, kind inside the specific WordPress price strategies you wish to have to hide from your checkout internet web page.

Choosing which PayPal's alternative payment methods to disable

Whilst you’ve made your imaginable possible choices, scroll down and click on on ‘Save Changes.’

Now, your most well-liked value methods will also be disabled.

Saving changes to the PayPal for WooCommerce settings

At this stage, you’ll be capable of move for your checkout internet web page to look if your variety value methods have disappeared.

Proper right here’s what happens if we disable the credit score or debit playing cards chance as a PayPal variety value means:

Removing credit and debit cards alternative payment method from PayPal in WooCommerce

👋 Phrase: PayPal mechanically presentations location-specific variety value simple how to your consumers. For instance, consumers inside the Netherlands will see iDEAL as a worth chance, while consumers in several spaces will only see value methods associated with their location.

How you can Disable Price Methods Enabled by the use of Stripe

When the usage of Stripe as your price gateway in WooCommerce, it mechanically lets in a couple of value possible choices. The ones include credit cards, debit taking part in playing cards, and even some local value possible choices in step with your house, like Alipay and WeChat.

WooCommerce's Stripe payment options

To enhance the consumer enjoy, it’s possible you’ll want to restrict value simple how to only those your consumers in fact use.

This manner, other people don’t get puzzled or by chance run into issues after choosing a method that won’t art work for them.

To take a look at this, move to WooCommerce » Settings » Expenses. Then, click on at the ‘Arrange’ button next to the Stripe chance.

Managing Stripe payment methods

On the next internet web page, scroll proper all the way down to the ‘Expenses accepted on checkout’ section.

Proper right here, you’ll be capable of disable value methods by the use of unchecking the ones you don’t want to offer.

Unchecking Stripe payment options in WooCommerce

Stripe provides a large number of value gateways in WooCommerce, in conjunction with Apple Pay, Google Pay, Alipay, Klarna, Verify, and AfterPay.

Be sure to only permit the best value possible choices that make sense for your corporation and your consumers.

See also  Record Information and Folders in Linux

Whilst you’ve made up our minds for your hottest value methods, scroll down and click on on ‘Save Changes.’

Saving changes to Stripe for WooCommerce settings

👋 Phrase: Stripe presentations value methods in step with your store’s international cash settings. For instance, SEPA Direct Debit will only appear as a worth chance when your store is set to use EUR (Euro) as its international cash.

Proper right here’s what our checkout internet web page seems like after ACH Direct Debit and Alipay are disabled:

Disabling ACH and Alipay in Stripe

Selection 2: Set Up Conditional Price Gateways With a Free Plugin (Easy + Customizable)

Have you ever ever ever wanted to show different value possible choices to different consumers? That’s exactly what conditional value gateways do – they show or hide value methods in step with specific “if/then” rules.

For instance, it’s possible you’ll want to:

  • Disable cash on shipping for international consumers (because of this isn’t operationally possible).
  • Disable monetary establishment transfers for digital products (since these items are delivered straight away, it is going to have the same opinion prevent fraud).
  • Disable certain value possible choices for higher orders (to reduce transaction fees).

This is absolute best for firms like international retail outlets that need different value methods by the use of country, sumptuous producers that want secure value possible choices for high-value purchases, and wholesale shops that offer specific value words for bulk consumers.

The free Disable Fee Manner for WooCommerce plugin makes putting in conditional value possible choices easy and free. You’ll be capable of create rules in step with shipping zones, cart totals, client roles, time of day, and further, without touching any code.

First, you want to position in and switch at the plugin. For those who’re new to this process, check out our step-by-step knowledge on tips on how to set up a WordPress plugin for novices.

After you flip at the plugin, move to ‘Price Means’ for your WordPress admin area. Then, click on at the ‘+ Add disable value means rule’ button to begin out customizing your WooCommerce value methods.

Adding a rule to disable payment method in WooCommerce

Now, let’s uncover the basic settings. On the most productive, you’ll to search out the ‘Status’ switch. This activates or deactivates each rule to disable value methods.

Under ‘Rule kind,’ you’ll be ready to make a choice from two possible choices: disable specific value methods or price additional fees for value processing. For this tutorial, we’ll make a selection the main chance.

That being said, the second chance is excellent if you want to pass processing fees for certain value methods – for instance, together with a small rate for credit card expenses.

If you want to be told further about this, check out our knowledge on tips on how to go price processing charges to shoppers in WordPress.

Setting up the rule to disable payment methods in WooCommerce

Next, let’s give the rule of thumb of thumb a descriptive establish. The usage of clear, descriptive names for your value rules makes it more uncomplicated to keep an eye on a couple of conditional value settings later.

For instance, if you happen to occur to’re disabling Purchase Now Pay Later possible choices, it’s possible you’ll establish it ‘Disable BNPL methods.’

Now, inside the ‘Disable this value methods*’ box, select which possible choices you’d like to disable.

Choosing what payment methods to disable in WooCommerce

Inside the box beneath that, you’ll be capable of moreover optionally disable value methods for specific currencies, which is excellent if you happen to occur to run a multi-currency WooCommerce retailer. This selection is particularly useful for international shops where certain value gateways only art work with specific currencies.

In our example, we’ll disable value gateways like Klarna, Confirm, and Afterpay, as the ones are all Acquire Now Pay Later services and products and merchandise.

Moving down, you’ll to search out the section for putting in conditional value rules. In ‘Beneath conditions come to a decision when to disable value methods,’ you’ve two possible choices.

‘All of the beneath rules should are compatible’ means that each scenario you put should be true for the fee option to be disabled. For instance, if you happen to occur to set conditions for every cart total and client serve as, then consumers should meet every conditions previous to the fee means disappears.

‘Any one of the vital necessary beneath rule should are compatible’ manner the fee means will also be disabled when just one scenario is met. So, if you happen to occur to set rules for each cart total or client serve as, meeting merely this type of conditions will hide the fee chance.

For this case, we can use the main chance.

Choosing a rule for the conditions to disable payment methods in WooCommerce

Now, click on on on the ‘Make a selection scenario’ dropdown menu. Proper right here, you’ll to search out numerous categories to create conditional value rules, in conjunction with location, product, shipping means, cart total, date and time, and client serve as.

As an example, let’s prepare a worth gateway for specific cart values. We’ll make a selection ‘Cart Subtotal (Faster than Bargain)’ from the ‘Cart Equivalent’ magnificence to disable value methods like Acquire Now Pay Later possible choices when orders exceed a certain amount.

That is serving to scale back faux orders and fraud for higher-value purchases for your WooCommerce store.

Choosing a condition for disabling the payment method

Next, you’ll be ready to choose whether or not or to not disable value methods when the location is:

  • Identical to (=)
  • A lot much less or Identical to (<=)
  • Less than (<)
  • Better or similar to (>=)
  • Greater than (>)
  • Not similar to (!=)

In our example, we’ll use ‘Better or similar to’ since we want to disable certain value gateways in WooCommerce when orders reach or exceed our threshold amount.

Choosing an equation for the condition to disable payment methods in WooCommerce

Finally, enter your purpose price inside the remainder field.

In our case, we’ll kind in ‘250.’ On account of this when a customer’s cart reaches $250 or further, WooCommerce will disable the Purchase Now Pay Later price strategies we made up our minds on earlier.

Choosing an amount for the cart subtotal rule to disable payment methods in WooCommerce

One thing we adore about this plugin is that you just’ll be capable of create complicated conditional value rules by the use of combining a couple of conditions.

For instance, you wish to have to ban value possible choices in step with cart totals and specific dates. This is able to art work totally for managing value methods far and wide holiday product sales categories.

As a way to upload another scenario for your WooCommerce value rules, simply click on at the fairway ‘Add Scenario’ button. After that, observe the identical steps.

Each new scenario helps you fine-tune exactly when and the way in which value methods appear on your checkout internet web page.

Adding a new condition to disable payment methods in WooCommerce

Whilst you’re glad together with your conditional value rules, click on on ‘Save Rule.’

The associated fee methods you’ve made up our minds on will mechanically be hidden for your WooCommerce checkout when consumers meet your specified conditions.

Example of disabling BNPL payment methods based on cart conditions

Now, let’s take a look at a few examples of recommendations on methods to prepare value gateway rules for various business needs:

How you can Disable Cash on Provide for International Consumers

Do you advertise products internationally and offer cash on shipping?

If so, you’ll have to disable this value means for international consumers. This may occasionally keep away from value collection issues and reduce shipping risks.

To take a look at this, you’ll be capable of create a brand spanking new rule and establish it something like ‘Disable COD for Non-[Country Name] Consumers.’ Then, select ‘Cash on shipping’ inside the fee methods section.

Disabling Cash on Delivery for non-US customers

For the location, make a selection ‘Country’ from the web page possible choices and select ‘Not Identical to (!=).’

After that, enter your store’s country.

Setting up a rule to disable Cash on Delivery for non-US customers

Now, the cash-on-delivery value means will only appear for local consumers. At the identical time, it’ll be mechanically hidden for anyone ordering from other global places.

Proper right here’s how our checkout internet web page turns out when regarded as as a customer from Japan:

An example of disabling cash on delivery for non-US customers

How you can Disable Monetary establishment Transfers for Digital Products

Digital products need specific care because of they’re delivered right away, and fiscal establishment transfers will also be unhealthy on account of sluggish processing circumstances. On account of this, we recommend disabling this value chance for your digital pieces.

First, be sure that your entire digital products are within the identical magnificence (like ‘Digital products’). For those who haven’t sorted your products however, check out our knowledge on tips on how to upload product tags, attributes, and classes in WooCommerce.

Then, create a brand spanking new rule and establish it ‘Disable Monetary establishment Transfer for Digital Products.’ Pick ‘Direct monetary establishment transfer’ since the value means you wish to have to disable.

Disabling bank transfers for digital products

For the location, you’ll be ready to choose ‘Cart has comprised of magnificence’ from the product possible choices.

Then, select your virtual merchandise magnificence.

Creating a rule to disable bank transfers when the cart has a product in the digital goods category

And in addition you’re completed!

Now, when anyone buys an products from the digital product magnificence, they won’t see the monetary establishment transfer chance at checkout.

Example of disabling bank transfers when a digital product is being purchased

How you can Disable Specific Price Methods for Large Orders

You probably have ever processed large orders for your WooCommerce store, then you understand that percentage-based value gateway fees can take a huge chunk out of your income.

For instance, PayPal charges 2.99% + a suite rate. On a $1,000 order, that’s spherical $30 in fees!

So, proper right here’s recommendations on methods to prepare conditional value gateways to provide more cost effective value possible choices for high-value purchases.

For this case, we’ll focus on PayPal since its percentage-based fees can change into particularly pricey for small industry house owners coping with large transactions.

See also  Perceive Devices in CSS: A Complete Information

First, create a brand spanking new rule and establish it ‘Disable PayPal for Best-Price Orders.’ Make a selection ‘PayPal’ from your WooCommerce value methods.

Disabling PayPal for high-value orders

In ‘Beneath conditions come to a decision when to disable value methods,’ make a selection ‘Any one of the vital necessary beneath rule should are compatible.’

For the main scenario, you want to select ‘Cart Subtotal (Faster than discount),’ select ‘Better or similar to,’ and enter ‘1000’ (keep an eye on this amount in step with your value gateway fees).

For the second scenario, make a selection ‘Cart quantity,’ select ‘Greater than or similar to,’ and enter ’10’ (or regardless of amount is smart for your corporation).

Setting up rules for PayPal to be disabled in checkout

Now, when a customer’s order meets each scenario – spending $1000 or further, OR ordering 10 or further items – PayPal won’t appear as a worth chance at checkout.

You’ll be capable of place a check out order and move for your checkout internet web page to look if the principles art work:

Placing a test order to see if PayPal gets disabled for high-value orders

📌 Looking for more effective ways to maximize income? Learn how to save money with our knowledge on tips on how to scale back your Stripe processing charges in WordPress.

Selection 3: Use Wholesale Suite to Prohibit Price Methods (For Wholesale Consumers)

For those who offer wholesale pricing, you then certainly’ll possibly want to set different value gateways in step with client serve as. Likelihood is that you’ll want to offer not unusual consumers the entire same old value methods alternatively restrict them for wholesale consumers.

This manner, you’ll be capable of maximize your income and cut back any value protection risks.

For instance, wholesale consumers forever make very large purchases, and most likely value possible choices (like PayPal) have larger fees. To keep away from the ones steep fees reducing into income, you wish to have to disable PayPal for wholesale consumers.

Similarly, it’s possible you’ll turn off Acquire Now Pay Later possible choices in order that you don’t will have to look ahead to an extended period for massive sums of money (or probability in no way receiving them).

When you’ll be capable of prepare conditional value gateways the usage of the plugin from Selection 2, wholesale plugins normally already include this feature.

The Wholesale Suite plugin bundle deal, for instance, has built-in plugins to keep an eye on value methods in step with wholesale client roles. It’s going to enhance the consumer enjoy for your B2B consumers.

To get started, move ahead and set up those WordPress plugins from the Wholesale Suite for your online store:

While the Skilled fashion comes with a price tag, it unlocks an important wholesale choices, in conjunction with value means regulate and tiered pricing.

You’ll be capable of be informed our detailed Wholesale Suite evaluate for more information.

Once every plugins are vigorous, remember to have your wholesale store basics in place. Listed below are some helpful tutorials you’ll be capable of observe:

To restrict specific value simple how to wholesale consumers, you’ll be capable of move to Wholesale » Settings. Then, select ‘Price Gateway.’

Editing the Wholesale Suite's Payment Gateway settings

Next to ‘Wholesale Place,’ select the ‘Wholesale Purchaser’ serve as that the plugin has prepare. Then, kind inside the fee gateways you wish to have to permit.

Once completed, merely click on on ‘Add Mapping.’

Choosing what payment gateways to enable in Wholesale Suite

You’ll have to now see all of the enabled value gateways inside the table beneath.

Like so:

Enabled payment gateways in Wholesale Suite

Now, if the shopper logs in as a Wholesale Purchaser, they will only see this actual value means on their checkout internet web page.

Proper right here’s an example:

What the checkout page looks like as a wholesale customer when only debit and credit cards are enabled

Selection 4: Use Advanced Coupons to Prohibit Price Methods (For Specific Coupons)

Want to offer rewards for the usage of certain value methods?

You’ll be capable of do this by the use of rising coupons tied to specific value possible choices, which encourages consumers to use those hottest value methods.

While the plugin from Selection 2 in this knowledge can care for this procedure, coupon plugins like Complex Coupons include this feature by the use of default. We love this plugin because it implies that you’ll create detailed rules and customizations for your payment-specific discounts.

First, you want to set up those WordPress plugins for your WordPress admin area:

The highest charge fashion is paid, alternatively you’ll need it to restrict value methods and create complicated coupon rules. For more information, check out our whole Complex Coupons evaluate.

Next, prepare your coupons by the use of going to Coupons » Add New.

Creating a new Advanced Coupons coupon

Then, you’ll be capable of configure your coupon settings however you like. For detailed instructions, be informed our step-by-step knowledge on tips on how to create good coupons in WooCommerce.

For this tutorial, we’ll focus on rising payment-specific discounts. We’ll create a coupon code known as PAYPAL20 that gives consumers a 20% discount when they make a selection PayPal as their value means.

Creating a PayPal-specific coupon code in Advanced Coupons

To restrict the fee means for the coupon, scroll down and to search out the ‘Price Methods Restriction’ tab. Take a look at the sector that says ‘When checked, will permit value methods restriction check out when coupon is applied.’

For the ‘Kind,’ you’ve to make a choice ‘Allowed.’

Configuring the Payment Methods Restriction setting in Advanced Coupons

Then, in ‘Price Methods,’ enter PayPal.

After that, be happy to continue putting in your coupon. For instance, you’ll be capable of create an auto-apply coupon URL and share it together with your possible consumers.

Restricting the Advanced Coupons coupon to PayPal

Whilst you’re finished configuring the ones settings, click on on ‘Exchange’ or ‘Submit’ to avoid wasting a whole lot of your coupon.

It’s as simple as that!

Saving changes to the Advanced Coupons coupon

When consumers use this coupon, they’ll see PayPal as the only value means.

The bargain may also be applied to their order summary.

Applying the PayPal-specific Advanced Coupons coupon

Selection 5: Add Custom designed Code to Disable Price Methods (Advanced + No Plugin)

For those who don’t want to use a faithful value plugin, you then’ll be capable of moreover get the identical results with numerous strains of custom designed code. We’ll show you recommendations on methods to disable value methods in step with two now not ordinary scenarios: customer location (country) and cart total.

Understand that this implies is further technical than the previous possible choices. It requires together with code for your functions.php report, which controls how your WordPress web page behaves.

However, we don’t suggest editing your functions.php report immediately, as making even a small mistake can injury your entire web page. As a substitute, we suggest the usage of WPCode, which is a code snippet manager this is serving to you add custom designed code safely.

While it is a plugin, it’s a lightweight tool for numerous customizations previous value methods, very similar to together with tracking codes, custom designed functions, or analytics.

You’ll be capable of be informed our whole WPCode evaluate and our knowledge on the most dear WordPress code snippets for freshmen to look what you’ll be capable of do with WPCode.

Faster than we start, we want to know the ID of the fee gateway that we want to disable. To take a look at this, merely move to WooCommerce » Settings and switch to the ‘Expenses’ tab.

Configuring the WooCommerce payments settings

Then, hover your cursor over one of the vital necessary value methods.

As you do this, pay attention to the URL preview that appears at the bottom of your browser. It’s going to must look something like this: https://example.com/wp-admin/admin.php?internet web page=wc-settings&tab=checkout&section=payment-gateway-id

The segment at the end that follows &section= is your value gateway ID. So, for instance, if you happen to occur to hover over the PayPal chance, then the ID is ppcp-gateway.

PayPal payment gateway ID

Be sure to have in mind of this information, as you’ll need it inside the next steps.

Now, arrange WPCode on your WordPress website online. You’ll be capable of be informed our step-by-step knowledge on tips on how to set up a WordPress plugin for detailed instructions.

Next, move to Code Snippets » + Add Snippet. Then, make a selection ‘Add Your Custom designed Code (New Snippet)’ and click on on on the ‘+ Add Custom designed Snippet’ button.

Add Custom Snippet button in WPCode

After that, you’ll need to select a code kind.

For this tutorial, select ‘PHP Snippet.’

Choosing PHP snippet in WPCode

Now, let’s take a look at two code snippets you’ll be capable of add to disable specific value methods in WooCommerce.

How you can Disable Price Methods In step with Country

To take a look at this, you want to supply your code snippet a name like ‘Disable [Payment Method Name] for [Country Name].’

After that, you’ll be capable of paste the code snippet beneath into the ‘Code Preview’ box:

// Hook our custom designed function into the WooCommerce available value gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'customize_payment_gateway_based_on_country', 9999 );

function customize_payment_gateway_based_on_country( $available_gateways ) {

    // Take a look at if we're inside the admin area or if the WooCommerce customer object is not available.
    // If each is true, return the unmodified gateways.
    if ( is_admin() || ! WC()->customer ) {
        return $available_gateways;
    }
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Price Gateway ID
    //
    // Alternate 'your_gateway_id' with the ID of the fee gateway you wish to have to concentrate on.
    // For instance:
    //   - To concentrate on Stripe, replace with 'stripe'
    //   - To concentrate on PayPal, replace with 'paypal'
    //
    $gateway_id_placeholder = 'your_gateway_id';
    // -----------------------------------------------------------------------
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Country Code
    //
    // Alternate 'XX' with the specified country code where you wish to have to disable the gateway.
    // Country codes are in step with ISO 3166-1 alpha-2.
    // For instance:
    //   - To concentrate on the united states, use 'US'
    //   - To concentrate on the United Kingdom, use 'GB'
    //
    $target_country_code = 'XX';
    // -----------------------------------------------------------------------

    // Take a look at if the specified value gateway exists within the available gateways.
    if ( isset( $available_gateways[ $gateway_id_placeholder ] ) ) {
        // Retrieve the billing country of the current customer.
        $customer_country = WC()->customer->get_billing_country();

        // Assessment the consumer's billing country with the target country code.
        if ( $customer_country === $target_country_code ) {
            // If the consumer's country fits the target, remove the fee gateway.
            unset( $available_gateways[ $gateway_id_placeholder ] );
        }
    }
    
    // Return the (possibly modified) record of available gateways.
    return $available_gateways;
}

Now, you’ll want to customize two parts of this code.

First, to search out the $gateway_id_placeholder variable and replace ‘your_gateway_id’ with the ID of your value gateway.

To search out the $target_country_code variable and replace ‘XX’ together with your purpose country’s two-letter code. For instance:

  • US – United States
  • GB – United Kingdom
  • CA – Canada
  • AU – Australia

So, let’s say you wish to have to disable direct monetary establishment transfers for purchasers in the united states. If so, then your code should seem to be this:

// Hook our custom designed function into the WooCommerce available value gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'customize_payment_gateway_based_on_country', 9999 );

function customize_payment_gateway_based_on_country( $available_gateways ) {

    // Take a look at if we're inside the admin area or if the WooCommerce customer object is not available.
    // If each is true, return the unmodified gateways.
    if ( is_admin() || ! WC()->customer ) {
        return $available_gateways;
    }
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Price Gateway ID
    //
    // Alternate 'your_gateway_id' with the ID of the fee gateway you wish to have to concentrate on.
    // For instance:
    //   - To concentrate on Stripe, replace with 'stripe'
    //   - To concentrate on PayPal, replace with 'ppcp-gateway'
    //
    $gateway_id_placeholder = 'bacs';
    // -----------------------------------------------------------------------
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Country Code
    //
    // Alternate 'XX' with the specified country code where you wish to have to disable the gateway.
    // Country codes are in step with ISO 3166-1 alpha-2.
    // For instance:
    //   - To concentrate on the united states, use 'US'
    //   - To concentrate on the United Kingdom, use 'GB'
    //
    $target_country_code = 'US';
    // -----------------------------------------------------------------------

    // Take a look at if the specified value gateway exists within the available gateways.
    if ( isset( $available_gateways[ $gateway_id_placeholder ] ) ) {
        // Retrieve the billing country of the current customer.
        $customer_country = WC()->customer->get_billing_country();

        // Assessment the consumer's billing country with the target country code.
        if ( $customer_country === $target_country_code ) {
            // If the consumer's country fits the target, remove the fee gateway.
            unset( $available_gateways[ $gateway_id_placeholder ] );
        }
    }
    
    // Return the (possibly modified) record of available gateways.
    return $available_gateways;
}

This code will hide the direct monetary establishment transfer chance when consumers from the united states seek advice from your checkout internet web page.

Whilst you’ve customized the ones parts, switch the toggle from ‘Inactive’ to ‘Full of life,’ then click on on ‘Save Snippet.’

Disabling payment methods by country with WPCode

Now, you’ll be capable of move ahead and place a check out order to look if the code works.

Proper right here’s what our checkout internet web page seems like after we use the development code snippet for disabling PayPal for US-based consumers:

Example of disabling the bank transfer payment method for US customers with WPCode

How you can Disable Price Methods In step with Cart General

First, create a brand spanking new code snippet and offers it a descriptive establish, like ‘Disable [Payment Method] for Best-Price Orders.’

After that, paste the following code snippet into the ‘Code Preview’ box:

// Hook our custom designed function into the WooCommerce available value gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'disable_payment_gateway_for_high_cart_subtotal' );

function disable_payment_gateway_for_high_cart_subtotal( $available_gateways ) {
    // Take a look at if we're inside the admin area. If so, return the unmodified gateways to keep away from issues inside the backend.
    if ( is_admin() ) {
        return $available_gateways;
    }

    // Get the cart subtotal.
    $cart_total = WC()->cart->get_subtotal();

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Minimum Cart Subtotal
    // Alternate 123 with the specified minimum cart subtotal above which you wish to have to disable the gateway.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Price Gateway ID
    // Alternate 'your_gateway_id' with the ID of the fee gateway you wish to have to concentrate on.
    // For instance:
    //   - To concentrate on Stripe, replace with 'stripe'
    //   - To concentrate on PayPal, replace with 'ppcp-gateway'
    // -----------------------------------------------------------------------


    // Take a look at if the cart total meets the minimum and if the specified value gateway is available.
    if ( $cart_total >= 123 && isset( $available_gateways['your_gateway_id'] ) ) { 
        // Remove the fee gateway.
        unset( $available_gateways['your_gateway_id'] );  
    }

    // Return the (possibly modified) record of available gateways.
    return $available_gateways;
}

You’ll want to customize two parts of this code. First, to search out the cart subtotal price in this line:
if ( $cart_total >= 123 && isset( $available_gateways['your_gateway_id'] ) ) {

Simply replace ‘123’ together with your required minimum amount (don’t include international cash symbols).

Next, to search out ‘your_gateway_id’ and replace it together with your value gateway ID like previous to.

So, if you want to disable PayPal for orders over $100, you most likely can set the price to ‘100’ and use ‘ppcp-gateway’ since the gateway ID.

Proper right here’s what all of the code snippet would seem to be:

// Hook our custom designed function into the WooCommerce available value gateways filter.
add_filter( 'woocommerce_available_payment_gateways', 'disable_payment_gateway_for_high_cart_subtotal' );

function disable_payment_gateway_for_high_cart_subtotal( $available_gateways ) {
    // Take a look at if we're inside the admin area. If so, return the unmodified gateways to keep away from issues inside the backend.
    if ( is_admin() ) {
        return $available_gateways;
    }

    // Get the cart subtotal.
    $cart_total = WC()->cart->get_subtotal();

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Minimum Cart Subtotal
    // Alternate 123 with the specified minimum cart subtotal above which you wish to have to disable the gateway.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Price Gateway ID
    // Alternate 'your_gateway_id' with the ID of the fee gateway you wish to have to concentrate on.
    // For instance:
    //   - To concentrate on Stripe, replace with 'stripe'
    //   - To concentrate on PayPal, replace with 'ppcp-gateway'
    // -----------------------------------------------------------------------


    // Take a look at if the cart total meets the minimum and if the specified value gateway is available.
    if ( $cart_total >= 100 && isset( $available_gateways['ppcp-gateway'] ) ) { 
        // Remove the fee gateway.
        unset( $available_gateways['ppcp-gateway'] );  
    }

    // Return the (possibly modified) record of available gateways.
    return $available_gateways;
}

Whilst you’ve customized the ones parts, switch the toggle from ‘Inactive’ to ‘Full of life.’

Then, click on on ‘Save Snippet.’

Disabling PayPal for high-value orders with WPCode

Finally, check out creating a check out order to look if the code works.

Proper right here’s what you’ll have to see on your checkout internet web page if you happen to occur to disable PayPal for orders above $100:

Example of disabling PayPal for high-value orders with WPCode

Further Ways to Reinforce Your WooCommerce Store

Now that you know how to keep an eye on value methods in WooCommerce, listed here are other problems you’ll be capable of do to build a better online store:

🚨 Ready to take your online store to the next stage? Let our WPBeginner Professional Services and products staff assist you to assemble a certified WooCommerce store. We’ll prepare your value gateways, optimize your checkout process, and ensure your store runs simply. Plus, you’ll get a faithful project manager to oversee each part of your store setup.

Guide a Unfastened Session Name With Our Crew Lately!

We hope this text has helped you learn how to disable value methods in WooCommerce. You may also want to take a look at our knowledge on tips on how to upload a loose transport bar in WooCommerce and our professional possible choices of the very best Authorize.web plugins for WordPress.

For those who most well-liked this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You’ll be capable of moreover to search out us on Twitter and Fb.

The put up How one can Disable Fee Strategies in WooCommerce (Final Information) first gave the impression on WPBeginner.

WordPress Maintenance

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!