700+ Best Free WordPress Tutorials (Step by Step) https://www.wpbeginner.com Beginner's Guide for WordPress Tue, 01 Apr 2025 10:06:13 +0000 en-US hourly 1 How to Keep Personally Identifiable Info Out of Google Analytics https://www.wpbeginner.com/wp-tutorials/how-to-keep-personally-identifiable-info-out-of-google-analytics/ https://www.wpbeginner.com/wp-tutorials/how-to-keep-personally-identifiable-info-out-of-google-analytics/#respond Tue, 01 Apr 2025 10:00:00 +0000 https://www.wpbeginner.com/?p=337553 Recently, we discovered something alarming while auditing one of our clients’ websites. Email addresses and phone numbers were showing up in their Google Analytics reports, exposing sensitive visitor information that they never intended to collect. Collecting personally identifiable information from users can be a major… Read More »

The post How to Keep Personally Identifiable Info Out of Google Analytics first appeared on WPBeginner.

]]>
Recently, we discovered something alarming while auditing one of our clients’ websites. Email addresses and phone numbers were showing up in their Google Analytics reports, exposing sensitive visitor information that they never intended to collect.

Collecting personally identifiable information from users can be a major issue. Not only does it violate privacy regulations like GDPR, but it also puts your business at risk of hefty fines and losing the trust of your customers.

But here’s the good news: preventing personally identifiable information (PII) from ending up in your analytics is actually quite straightforward once you know how.

We’ve spent years working with Google Analytics across hundreds of websites, and we’ve developed a foolproof system to keep sensitive data out of your reports. In this guide, we’ll show you exactly how to protect your visitors’ privacy while still getting all the valuable insights you need from your analytics data.

How to Keep Personally Identifiable Info Out of Google Analytics

What Is Personally Identifiable Information, and Why Should You Protect It?

Personally Identifiable Information (PII) is any data that, when combined, can reveal a person’s identity.

Some common examples of PII include:

  • Full name (first and last)
  • Email address
  • Phone number
  • Home address
  • Credit card information
  • Login credentials (usernames and passwords)
  • IP addresses (when linked to individuals)

The problem is that PII often sneaks into Google Analytics through URLs.

Let’s say that users submit personal details on contact forms or login pages on your WordPress site. This data can be embedded in the URL of the next page they visit.

The URL might look like this:

www.example.com/contact-us/thanks?email=personal@information.com.

In that example, we can see that the URL shows the user’s email address.

Why Should You Keep Personal Info Out of Analytics?

Privacy laws like GDPR are serious about protecting personal data. That’s one reason why Google doesn’t allow businesses to collect or store PII.

If your Google Analytics account is capturing PII, you could end up in trouble, facing hefty fines or having your account suspended.

And it’s not just a technical issue – it can have real consequences for your business. Users expect businesses to respect their privacy. But if they feel their data isn’t safe, they might take their business elsewhere.

That’s why it’s so important to keep PII out of your Google Analytics data.

With that in mind, we’ll show you how to keep personally identifiable information (PII) out of Google Analytics. Here’s a quick overview of the 2 methods we’ll share with you:

Ready? Let’s get started.

Method 1. Using a Plugin to Keep Personally Identifiable Info Out of Google Analytics

Google Analytics can be overwhelming to navigate, especially when trying to ensure compliance with privacy regulations.

Managing cookie consent, anonymizing IP addresses, and adjusting privacy settings can quickly become overwhelming. For many people, sorting through these settings and ensuring compliance is no easy task.

If you’re a WordPress user, then we have good news for you.

MonsterInsights is the best WordPress analytics plugin, and it integrates seamlessly with Google Analytics 4 (GA4). With its Privacy Guard feature, it offers privacy-friendly tracking that you can manage directly from your WordPress dashboard.

ℹ️ Quick note: MonsterInsights powers our conversion tracking at WPBeginner, helping us monitor traffic, forms, buttons, referral links, and more with ease. See why we love it in our detailed MonsterInsights review!

Step 1. Install and Activate the MonsterInsights Plugin

First, let’s get started by creating a MonsterInsights account. Just head over to the website and click the ‘Get MonsterInsights Now’ button.

MonsterInsights' homepage

You can then go ahead and choose a plan. For this tutorial, we recommend the Plus plan or higher, as it includes the Privacy Guard feature to help with compliance.

After signing up, you can install and activate the MonsterInsights plugin on your WordPress site. For step-by-step instructions, see our guide on how to install a WordPress plugin.

Step 2. Connect MonsterInsights to Your Google Analytics Account

Upon activation, you’ll need to connect the MonsterInsights plugin to your Google Analytics account.

In your WordPress dashboard, you need to go to Insights » Launch the Wizard to start the setup.

The MonsterInsights setup wizard

After that, you’ll select the category that best describes your website.

MonsterInsights gives 3 options – business site, publisher (blog), or eCommerce (online store).

The MonsterInsights setup wizard

After selecting a category, simply click ‘Save and Continue’ to proceed.

On the next screen, you can click ‘Connect MonsterInsights’ to start the connection process.

How to connect WordPress to Google Analytics using MonsterInsights

Then, you can follow the prompt to sign in to your Google Analytics account.

Upon signing in, you can select the website you want to track from the dropdown menu.

Connect WordPress site to Google Analytics using MonsterInsights

From here, go ahead and click the ‘Complete Connection’ button. MonsterInsights will then automatically install Google Analytics on your WordPress website.

For details, feel free to refer to our guide on how to install Google Analytics in WordPress.

Step 3. Enable the Privacy Guard Feature

Keeping Personally Identifiable Information (PII) out of your tracking doesn’t have to be complicated.

With MonsterInsights’ Privacy Guard, you can do it in just a few clicks!

This feature automatically scans your website for sensitive information. It checks for any private details and prevents them from being stored in your analytics reports.

These details can be:

  • Form submission data, such as personal information entered in contact or registration forms.
  • URL data, which is the full web address of the page, including the domain name, path, and any additional information.
  • Query parameters, which are the bits of data in URLs, like “?id=1234.” They often track specific user actions or provide extra information to the website.

To do this, let’s navigate to the Insights » Settings » Engagement tab.

The Engagement tab

From here, you can go ahead and turn on the ‘Privacy Guard’ switch – that’s it!

MonsterInsights will now help protect personally identifiable information and keep you compliant with privacy laws.

Enabling Privacy Guard

⚠️ Important Disclaimer: No plugin can guarantee 100% legal compliance because every website is different. We strongly recommend consulting an Internet law attorney to ensure your site meets all legal requirements for your location and specific use case.

This is not legal advice – just a friendly heads-up to help you stay informed!

Method 2. Keeping Personally Identifiable Info Out of Google Analytics

In this method, we’ll guide you through configuring the settings that you need to keep PII out of Google Analytics directly from its dashboard.

This option is best for advanced users, as it gives you full control over the setup.

Additionally, since this method isn’t limited to WordPress, you can follow along even if you made your website with a different website builder.

First, you’ll need to sign in to your Google Analytics account.

Signing in to Google Analytics

Go ahead and click on the ‘Sign in to Analytics’ button.

In the dashboard, let’s hover over the sidebar and click the ‘Admin’ menu.

Locating the Admin menu

Once inside, you’ll want to locate the ‘Data collection and modification’ section.

After that, let’s click on ‘Data streams.’

The Data Streams menu

This will take you to the table, which lists all your data streams.

Now, you can select your website from the list.

List of data streams

This will open the ‘Web stream details’ slide-in.

From here, let’s scroll down to the ‘Events’ section and click ‘Redact data.’

Redact data menu

On the next screen, you will see the ‘Redact data’ menu.

The ‘Choose what to redact’ section of this slide-in has two switches at the top.

Let’s first redact email addresses by flipping the switch. Google Analytics will then automatically exclude email addresses from the data it collects.

Enabling email redact

Then, you can filter out other PII by entering query parameters.

To do this, you’ll need to enable the switch for ‘URL query parameter.’ Then, you can enter your query parameters in the respective field.

For example, here, we added ‘name,’ first_name,’ ‘last_name,’ and ‘ip_address.’

Enabling URL query parameter redact

Once everything looks good, you can save your settings.

Google Analytics will now help protect PII and keep your site privacy-compliant.

⚠️ Important Disclaimer: Configuring settings manually in the GA4 dashboard requires precise knowledge of which data needs to be redacted.

This can be tricky, and even a small mistake may result in sensitive information being collected.

We recommend thoroughly reviewing your data collection settings to ensure all PII is properly excluded. Always take the necessary precautions, as improper configuration could lead to compliance issues.

Bonus Tips for Privacy Compliance on Your Website

Keeping personal info out of analytics reports is just one way to comply with privacy regulations. We also recommend following these tips:

For more details, just see our complete guide to GDPR compliance for WordPress users.

FAQs About Keeping Personally Identifiable Info Out of Google Analytics

Keeping PII out of Google Analytics is important for privacy and compliance. If you still have questions, feel free to take a look at some quick answers to common questions:

How does Google handle user data and privacy concerns?

Google takes privacy seriously. It anonymizes data and complies with strict regulations like GDPR.

While Google provides tools to help businesses protect user privacy, it’s ultimately up to the businesses to make sure they don’t collect personally identifiable information (PII).

Does Google Analytics collect personally identifiable information?

Not by default. But if you’re not careful, PII can sneak in through URLs, form submissions, or custom tracking settings. That’s why it’s important to set things up correctly.

Do all sites with analytics need cookie warnings?

Yep! If your site tracks users with cookies (like Google Analytics does), then privacy laws like GDPR and CCPA require you to show a cookie notice and get user consent.

Further Reading: More Analytics and Tracking Guides

Understanding how to keep PII out of Google Analytics is just the beginning! If you want to fine-tune your tracking, improve data accuracy, and stay compliant with privacy laws, then check out these helpful guides:

📊 Google Analytics 4: A Beginner’s Guide – Learn how to set up GA4 on your WordPress site and make the most of its powerful features.

That’s all there is to it! We hope this guide has helped you learn how to keep personal info out of Google Analytics. You may also like to see our guide on how to get a custom email alert in Google Analytics or our expert pick of the best WordPress GDPR plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Keep Personally Identifiable Info Out of Google Analytics first appeared on WPBeginner.

]]>
https://www.wpbeginner.com/wp-tutorials/how-to-keep-personally-identifiable-info-out-of-google-analytics/feed/ 0
How to Easily Get a Custom Email Alert in Google Analytics (2 Ways) https://www.wpbeginner.com/wp-tutorials/how-to-easily-get-a-custom-email-alert-in-google-analytics/ https://www.wpbeginner.com/wp-tutorials/how-to-easily-get-a-custom-email-alert-in-google-analytics/#respond Fri, 28 Mar 2025 10:00:00 +0000 https://www.wpbeginner.com/?p=336299 Are you constantly logging into Google Analytics to check your website’s performance? We did this too when we first built a WordPress website. It was time-consuming and frustrating, especially when we wanted to track specific metrics or spot unusual patterns in our traffic. That’s when… Read More »

The post How to Easily Get a Custom Email Alert in Google Analytics (2 Ways) first appeared on WPBeginner.

]]>
Are you constantly logging into Google Analytics to check your website’s performance? We did this too when we first built a WordPress website. It was time-consuming and frustrating, especially when we wanted to track specific metrics or spot unusual patterns in our traffic.

That’s when we discovered Google Analytics custom email alerts. These automated notifications have saved us countless hours and helped us catch important changes on our websites before they became serious issues. Instead of manually checking stats multiple times a day, we now get instant notifications when something important happens.

In this guide, we’ll show you two simple ways to set up custom email alerts in Google Analytics. We’ve tested these methods across multiple websites and helped hundreds of business owners implement them through WPBeginner.

Whether you want to track sudden traffic drops, monitor conversion goals, or keep an eye on specific campaigns, we’ll show you exactly how to do it without getting lost in technical details.

How to Easily Get a Custom Email Alert in Google Analytics

What Are Custom Email Alerts in Google Analytics? And Why Do You Need Them?

Imagine waking up one morning to find out that your website traffic has suddenly dropped. Or your social media post went viral overnight, bringing in thousands of new visitors.

Wouldn’t you want to know right away? That’s exactly what custom email alerts in Google Analytics (GA4) do for you! 🚨

These alerts are called Custom Insights in GA4. They automatically notify you of big changes in your website data, so you don’t have to check analytics all the time. GA4 refers to these changes as anomalies.

With Custom Insights, you can create alerts for key anomalies, like:

  • A drop in overall or organic traffic
  • A spike in direct traffic
  • A sudden decrease in sales or ad revenue
  • A big jump in traffic or conversions

These alerts help you act fast, whether to fix an issue or make the most out of a new opportunity.

How to Get a Custom Email Alert in Google Analytics

Now that you know the benefits of custom email alerts in Google Analytics, let’s go over two ways to set them up.

If you use WordPress, then the easiest option is the MonsterInsights plugin. It sets up alerts for you so you don’t have to deal with complex settings. Plus, you can manage everything right from your WordPress dashboard.

If you don’t use WordPress or prefer a hands-on approach, then you can also set up alerts manually in Google Analytics. This method takes more steps but works for any website.

Feel free to use these jump links to go to your preferred method:

Let’s get started!

Note: You will need a Google Analytics account before following either of our tutorial methods. If you don’t have one yet, then please see our guide on how to install Google Analytics.

Method 1. Get Custom Email Alerts Using a Google Analytics Plugin

Navigating Google Analytics can be confusing at times. If you’re looking for an easy way to create custom Google Analytics email alerts, then this method is for you. That said, do note that this will only work for WordPress users.

Here, we’ll be using MonsterInsights, which is the best Google Analytics plugin on the market. It brings Google Analytics 4 (GA4) right into your WordPress dashboard and makes reports much easier to understand for beginners.

Plus, it has the Exception addon that automatically spots unusual spikes or drops in your data. With this addon, you’ll always be in the loop without the extra work!

✋ At WPBeginner, we trust MonsterInsights to track everything across our website, including our form, button, and referral link conversions. Learn more about the tool in our complete MonsterInsights review and see why we love it!

Step 1. Install and Activate the MonsterInsights Plugin

First, let’s create a MonsterInsights account. On the website, you can simply click on the ‘Get MonsterInsights Now’ button and choose your plan.

After that, simply follow the instructions for the checkout process.

MonsterInsights' homepage

✏️ Quick note: In this tutorial, we’re using the MonsterInsights Agency version since it includes the Exceptions addon (which we’ll need in Step 3). However, if you’re just getting started, then the free MonsterInsights version is a great option to try out!

With that done, you can install and activate the MonsterInsights plugin in your WordPress dashboard. For details, you can see our guide on how to install a WordPress plugin.

Step 2. Connect MonsterInsights to Your Google Analytics Account

Once you’ve installed MonsterInsights, the next step is to connect it to your site and Google Analytics.

To do this, you’ll need to click on the ‘Insights’ menu from your WordPress admin area.

Then, go ahead and click the ‘Launch the Wizard’ button to start the setup process.

The MonsterInsights setup wizard

Next, you’ll need to choose the category that best describes your website – whether it’s a blog, business site, or online store.

After choosing a category, click ‘Save and Continue.’

The MonsterInsights setup wizard

In the next steps, simply follow the prompts to sign in to your Google Analytics account and select the website you want to track.

Once you see the ‘Complete Connection’ button, just click it – and you’re all set!

Complete connection

For a detailed walkthrough, you can read our guide on how to install Google Analytics in WordPress.

Step 3. Set Up the MonsterInsights Exceptions Addon

In this step, we’ll add the Exceptions addon to track 16 types of unusual activity, such as sudden drops in traffic, conversion spikes, unexpected bounce rate changes, and more!

Whenever something ‘exceptional’ happens, you’ll get a detailed record in your Exceptions report. This means you can spot issues early and take action before they turn into bigger problems.

To get the Exceptions addon set up, let’s go to Insights » Add-ons.

In the ‘Exceptions’ box, you can click the ‘Download & Activate’ button. Then, simply click on the switch when it appears.

Installing the Exceptions addon

Upon activation, the addon will start tracking irregularities.

You can see the report by navigating to the dedicated ‘Exceptions’ tab from your ‘Reports’ page.

The Exceptions report in MonsterInsights

Note: Not using a MonsterInsights Agency account? No worries – you can still monitor your site’s key metrics right from your WordPress dashboard. 💡

Just go to the Insights » Reports page, where you’ll find useful insights on your website’s traffic, campaigns, and site speed, for example.

MonsterInsights Reports

Step 4. Get MonsterInsights Exception Alerts

Now, it’s time to set up email alerts to keep track of sudden shifts on your site.

To do this, you can head over to Insights » Settings » Advanced.

The Advanced tab in MonsterInsights

From here, let’s locate the ‘Exception Alerts’ section.

To get alerts, simply toggle the switch to ‘Enabled.’

Enabling Exceptions alerts

Next, you can add the email addresses that should receive notifications.

You can enter up to 5 email addresses. Just click the ‘Add Email’ button to include more.

Adding email addresses for receiving alerts

With that done, you’ve successfully set up Exception Alerts using MonsterInsights. Note that you’ll start getting alerts one day after an exception is detected.

📌 Expert Tip: Once your notification emails are set up, it’s a good idea to send a test email to make sure everything is working smoothly. If you run into any issues, then you can follow our guide on how to fix WordPress not sending emails.

Across our company, we use WP Mail SMTP to make sure our emails reach users’ inboxes and not the spam folder. Check out our full WP Mail SMTP review to see all the features!

Bonus Step: Set Up Weekly Email Summaries

With MonsterInsights, you can also receive weekly email summaries to track your WordPress site’s performance.

You can start by enabling the ‘Email Summaries’ feature under Settings » Advanced.

Enabling MonsterInsights' Email Summaries

Next, you’ll have to add email addresses to receive notifications and customize the email header for your alerts.

For step-by-step instructions, you can check out this guide on how to get automated Google Analytics email reports on the MonsterInsights blog.

Method 2. Get Custom Email Alerts in Google Analytics

With this method, we’ll show you how to set up email alerts directly in the Google Analytics dashboard.

This approach works for any website, making it a great option if you don’t use WordPress or prefer to manage everything inside GA4. However, it requires more manual setup, which takes more time and effort.

Before we start, let’s look at the 2 types of GA4 insights you can use for tracking important changes:

  • Automated Insights – Google’s machine learning helps identify trends and unexpected changes for you.
  • Custom Insights – You define the conditions to track exactly what matters most to your business.

Now, let’s walk through how to set each one up!

Step 1. Create Google Analytics Insights

First, you’ll want to sign in to your Google Analytics account.

Simply click on the ‘Sign in to Analytics’ button and enter your credentials.

Signing in to Google Analytics

From here, let’s go to the ‘Reports’ tab.

Scroll down to the ‘Insights’ section and click on the ‘Create’ button.

Creating custom GA Insights

On the next screen, you’ll see Google’s suggested alerts. These include unusual activity related to daily events, users, views, and revenue.

Here, you can check the ones you want. For example, we checked all the boxes like this:

Creating suggested custom GA insights

With that done, go ahead and click ‘Create selected’ to activate your suggested insights.

Step 2. Set Up Custom Google Analytics Insights

If you scroll down this page, you’ll see that Google Analytics lets you create custom alerts from scratch or use suggested insights.

If you want full control over what triggers an alert, then click ‘Create new’ under the ‘Start from scratch’ section. This lets you set your own conditions based on the metrics that matter most to you.

Expert Tip: You don’t have to choose between custom and suggested insights. You can use both to stay on top of key changes in your data! 🚀

Create custom GA insights from scratch

Next up, you’ll need to set your conditions:

  • The ‘Evaluation frequency’ can be hourly, daily, weekly, or monthly. This means how often Google Analytics will look at the data to see if it matches the conditions you set up.
  • ‘Segment’ lets you focus on a specific group of visitors for your alert.
  • ‘Metric’ allows you to set factors to track. For example, you might focus on conversions, page views, and revenue.
  • The ‘Condition’ dropdown is where you set a trigger for your alert. This might be an anomaly (something that is higher or lower than usual) or a specific number for the metric you choose.
Setting up custom insights conditions

After defining your rules, you can name your alert.

This is the name that will appear in your email notifications, so make sure it’s obvious and easy to refer to.

Then, go ahead and enter your email addresses for notifications.

Adding name and email addresses for the custom GA insights

Once everything looks good, don’t forget to click the ‘Create’ button in the top right corner to save your custom alert.

And that’s it – you’ve set up custom email alerts in Google Analytics!

Step 3. Manage Google Analytics Insights Alert

In this step, we’ll show you how to manage your custom Google Analytics insights alerts. This will enable you to turn alerts on and off, edit them, and delete them.

To do this, let’s navigate to Insights » View all insights from your ‘Reports snapshot’ screen.

Viewing all Google Analytics insights

Once inside, you can click the ‘Manage’ button.

This will open a slide-in menu to see all your custom alerts.

The Manage button

Here, you can toggle email notifications on or off as needed.

You can also click the three dots to edit or delete an alert.

The Edit and Delete options

And if you want to create more alerts, simply use the ‘Create’ button and repeat the process.

Further Reading: More Analytics and Tracking Guides

Want to dive deeper into analytics and tracking? Here are more helpful guides to level up your insights and help you make data-driven decisions:

That’s it!

We hope this article has helped you learn how to set up custom email alerts in Google Analytics. Next up, you might want to read our guide on how to set up Google Analytics goals and our expert picks for the best analytics solutions for WordPress users.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Easily Get a Custom Email Alert in Google Analytics (2 Ways) first appeared on WPBeginner.

]]>
https://www.wpbeginner.com/wp-tutorials/how-to-easily-get-a-custom-email-alert-in-google-analytics/feed/ 0
How to Disable Payment Methods in WooCommerce (Ultimate Guide) https://www.wpbeginner.com/wp-tutorials/how-to-disable-payment-methods-in-woocommerce/ https://www.wpbeginner.com/wp-tutorials/how-to-disable-payment-methods-in-woocommerce/#respond Thu, 27 Mar 2025 10:00:00 +0000 https://www.wpbeginner.com/?p=337228 Many WooCommerce store owners make the mistake of enabling every available payment method. But we’ve learned that having too many payment options can actually confuse your customers and even lead to abandoned carts. While running WooCommerce stores, we’ve found that strategically limiting payment options can… Read More »

The post How to Disable Payment Methods in WooCommerce (Ultimate Guide) first appeared on WPBeginner.

]]>
Many WooCommerce store owners make the mistake of enabling every available payment method. But we’ve learned that having too many payment options can actually confuse your customers and even lead to abandoned carts.

While running WooCommerce stores, we’ve found that strategically limiting payment options can improve conversion rates and streamline your checkout process. For example, you might want to disable certain payment methods based on shipping locations, product types, or even order totals.

The good news is that you can use the WooCommerce default settings or a plugin to control which payment methods your customers can use. You just need to know where to look and which settings to adjust.

In this guide, we’ll show you several proven ways to disable payment methods in WooCommerce. We’ll cover many different scenarios, whether you want to remove payment options completely or conditionally hide them based on specific rules.

How to Disable Payment Methods in WooCommerce

When to Disable WooCommerce Payment Methods 💳

Managing payment gateways in WooCommerce isn’t just about offering as many payment options as possible. Sometimes, you need to restrict payment methods to improve your business operations and avoid high transaction fees.

Limiting available payment methods can even improve the customer journey because offering too many choices at checkout can be confusing.

In our experience, keeping it simple with just Stripe for credit cards and PayPal works best for most international stores.

However, if you’re serving specific markets with local payment preferences, then you might need more control over when and how to display different payment options.

Here are common scenarios when you might want to have a WooCommerce payment disabled:

  • Cart Total – For instance, you may require specific payment methods for larger orders. This can help reduce transaction costs for payment gateways that charge percentage-based fees. Or, you might disable cash on delivery for high-value orders.
  • Customer Location – Some payment gateways only work in specific regions. In that case, you may need to hide them from customers who live outside of those areas. Similarly, some charge more in specific regions, so you might not want to offer them in certain regions.
  • User Role – You can set up payment gateways based on user roles, such as offering wholesale customers different payment options than regular buyers. Again, this can be useful to reduce transaction fees or risk for orders with higher price tags.
  • Special Periods – You might need to change payment options during holiday sales events, especially if those payment methods could slow down order processing.

All that said, let’s look at five different ways you can disable payment gateways in your WooCommerce store.

You can use the quick links below to skip to your preferred method:

👉 Note: In this article, we will assume that you have already set up a WooCommerce store. If you need help, you can read our guide on how to start an online store or our WooCommerce made simple tutorial.

Option 1: Disable Payment Methods Using WooCommerce Settings (For All Customers)

WooCommerce actually has built-in settings to disable payment methods, so you won’t need to install a WooCommerce plugin for this approach. That said, the steps here will depend a little on what you want to do.

We’ll show you how to disable your main payment methods, PayPal-specific options, and Stripe methods. That way, all your bases are covered.

Please note that we recommend only following one of the methods in this section if you want to completely disable a payment option for all customers.

That’s because these methods don’t allow you to hide payment options based on specific criteria like user roles or product categories.

How to Disable Your Main Payment Methods

You can disable one of your main payment methods (such as an entire payment gateway or direct bank transfers) directly in your WooCommerce settings.

Simply go to WooCommerce » Settings. Then, navigate to the ‘Payments’ tab. Once there, you’ll see all available payment gateways in WooCommerce.

Configuring the WooCommerce payments settings

We have enabled the following payment methods: Stripe for credit and debit cards, direct bank transfer, check payments, cash on delivery, and PayPal.

Here’s what the checkout looks like to customers when all of those options are active:

Active payment methods in WooCommerce checkout

To disable a WooCommerce payment, simply click the toggle switch under the ‘Enabled’ column for any active payment method.

Now, the payment option will no longer appear on your checkout page.

Disabling payment methods in WooCommerce

If you decide you want to enable some of those payment methods again later, you can always return to this page to reactivate them.

When you visit your checkout page, you should no longer see the disabled payment methods:

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

How to Disable PayPal’s Alternative Payment Methods

If you have multiple payment methods enabled via PayPal, then you can easily restrict them, too. For instance, your business might not be able to accept Venmo payments, so you may want to turn off this option.

PayPal payment options

First, you can use the same method we discussed above.

Go to WooCommerce » Settings » Payments. Then, you can click the toggle switch for any payment method labeled ‘(via PayPal).’

Disabling PayPal's alternative payment methods

Alternatively, you can click the ‘Manage’ button next to the PayPal option.

This will take you to the PayPal settings page.

Managing PayPal for WooCommerce settings

On the PayPal settings page, scroll down until you find the ‘Alternative Payment Methods’ section.

In the ‘Disable Alternative Payment Methods’ field, type in the specific WordPress payment methods you want to hide from your checkout page.

Choosing which PayPal's alternative payment methods to disable

Once you’ve made your choices, scroll down and click ‘Save Changes.’

Now, your chosen payment methods will be disabled.

Saving changes to the PayPal for WooCommerce settings

At this stage, you can go to your checkout page to see if your alternative payment methods have disappeared.

Here’s what happens if we disable the credit or debit cards option as a PayPal alternative payment method:

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

👋 Note: PayPal automatically shows location-specific alternative payment methods to your customers. For example, customers in the Netherlands will see iDEAL as a payment option, while customers in other regions will only see payment methods relevant to their location.

How to Disable Payment Methods Enabled by Stripe

When using Stripe as your payment gateway in WooCommerce, it automatically enables multiple payment options. These include credit cards, debit cards, and even some local payment options based on your region, like Alipay and WeChat.

WooCommerce's Stripe payment options

To improve the customer experience, you might want to restrict payment methods to only those your customers actually use.

This way, people don’t get confused or accidentally run into issues after choosing a method that won’t work for them.

To do this, go to WooCommerce » Settings » Payments. Then, click the ‘Manage’ button next to the Stripe option.

Managing Stripe payment methods

On the next page, scroll down to the ‘Payments accepted on checkout’ section.

Here, you can disable payment methods by unchecking the ones you don’t want to offer.

Unchecking Stripe payment options in WooCommerce

Stripe offers numerous payment gateways in WooCommerce, including Apple Pay, Google Pay, Alipay, Klarna, Affirm, and AfterPay.

Be sure to only enable the specific payment options that make sense for your business and your customers.

Once you’ve selected your preferred payment methods, scroll down and click ‘Save Changes.’

Saving changes to Stripe for WooCommerce settings

👋 Note: Stripe displays payment methods based on your store’s currency settings. For example, SEPA Direct Debit will only appear as a payment option when your store is set to use EUR (Euro) as its currency.

Here’s what our checkout page looks like after ACH Direct Debit and Alipay are disabled:

Disabling ACH and Alipay in Stripe

Option 2: Set Up Conditional Payment Gateways With a Free Plugin (Easy + Customizable)

Have you ever wanted to show different payment options to different customers? That’s exactly what conditional payment gateways do – they show or hide payment methods based on specific “if/then” rules.

For example, you might want to:

  • Disable cash on delivery for international customers (because this isn’t operationally possible).
  • Disable bank transfers for digital products (since these items are delivered instantly, this can help prevent fraud).
  • Disable certain payment options for larger orders (to reduce transaction fees).

This is perfect for businesses like international retailers that need different payment methods by country, luxury brands that want secure payment options for high-value purchases, and wholesale stores that offer special payment terms for bulk buyers.

The free Disable Payment Method for WooCommerce plugin makes setting up conditional payment options easy and free. You can create rules based on shipping zones, cart totals, user roles, time of day, and more, without touching any code.

First, you need to install and activate the plugin. If you’re new to this process, check out our step-by-step guide on how to install a WordPress plugin for beginners.

After you activate the plugin, go to ‘Payment Method’ in your WordPress admin area. Then, click the ‘+ Add disable payment method rule’ button to start customizing your WooCommerce payment methods.

Adding a rule to disable payment method in WooCommerce

Now, let’s explore the basic settings. At the top, you’ll find the ‘Status’ switch. This activates or deactivates each rule to disable payment methods.

Under ‘Rule type,’ you can choose between two options: disable specific payment methods or charge extra fees for payment processing. For this tutorial, we’ll pick the first option.

That being said, the second option is great if you want to pass processing fees for certain payment methods – for example, adding a small fee for credit card payments.

If you want to learn more about this, check out our guide on how to pass payment processing fees to customers in WordPress.

Setting up the rule to disable payment methods in WooCommerce

Next, let’s give the rule a descriptive name. Using clear, descriptive names for your payment rules makes it easier to manage multiple conditional payment settings later.

For example, if you’re disabling Buy Now Pay Later options, you might name it ‘Disable BNPL methods.’

Now, in the ‘Disable this payment methods*’ box, select which options you’d like to disable.

Choosing what payment methods to disable in WooCommerce

In the box below that, you can also optionally disable payment methods for specific currencies, which is great if you run a multi-currency WooCommerce store. This option is particularly useful for international stores where certain payment gateways only work with specific currencies.

In our example, we’ll disable payment gateways like Klarna, Affirm, and Afterpay, as these are all Buy Now Pay Later services.

Moving down, you’ll find the section for setting up conditional payment rules. In ‘Below conditions determine when to disable payment methods,’ you have two options.

‘All the below rules should match’ means that every condition you set must be true for the payment method to be disabled. For example, if you set conditions for both cart total and user role, then customers must meet both conditions before the payment method disappears.

‘Any one of the below rule should match’ means the payment method will be disabled when just one condition is met. So, if you set rules for either cart total or user role, meeting just one of these conditions will hide the payment option.

For this example, we will use the first option.

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

Now, click on the ‘Select condition’ dropdown menu. Here, you’ll find several categories to create conditional payment rules, including location, product, delivery method, cart total, date and time, and user role.

As an example, let’s set up a payment gateway for specific cart values. We’ll choose ‘Cart Subtotal (Before Discount)’ from the ‘Cart Related’ category to disable payment methods like Buy Now Pay Later options when orders exceed a certain amount.

This helps reduce fake orders and fraud for higher-value purchases in your WooCommerce store.

Choosing a condition for disabling the payment method

Next, you can choose whether to disable payment methods when the condition is:

  • Equal to (=)
  • Less or Equal to (<=)
  • Less than (<)
  • Greater or equal to (>=)
  • Greater than (>)
  • Not equal to (!=)

In our example, we’ll use ‘Greater or equal to’ since we want to disable certain payment 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 target value in the last field.

In our case, we’ll type in ‘250.’ This means that when a customer’s cart reaches $250 or more, WooCommerce will disable the Buy Now Pay Later payment methods we selected earlier.

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

One thing we love about this plugin is that you can create complex conditional payment rules by combining multiple conditions.

For example, you could restrict payment options based on cart totals and specific dates. This would work perfectly for managing payment methods during holiday sales periods.

To add another condition to your WooCommerce payment rules, simply click the green ‘Add Condition’ button. After that, follow the same steps.

Each new condition helps you fine-tune exactly when and how payment methods appear on your checkout page.

Adding a new condition to disable payment methods in WooCommerce

Once you’re happy with your conditional payment rules, click ‘Save Rule.’

The payment methods you’ve selected will automatically be hidden in your WooCommerce checkout when customers meet your specified conditions.

Example of disabling BNPL payment methods based on cart conditions

Now, let’s look at a few examples of how to set up payment gateway rules for other business needs:

How to Disable Cash on Delivery for International Customers

Do you sell products internationally and offer cash on delivery?

If so, you should disable this payment method for international customers. This will avoid payment collection issues and reduce shipping risks.

To do this, you can create a new rule and name it something like ‘Disable COD for Non-[Country Name] Customers.’ Then, select ‘Cash on delivery’ in the payment methods section.

Disabling Cash on Delivery for non-US customers

For the condition, choose ‘Country’ from the location options and select ‘Not Equal 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 payment method will only appear for local customers. At the same time, it will be automatically hidden for anyone ordering from other countries.

Here’s how our checkout page appears when viewed as a customer from Japan:

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

How to Disable Bank Transfers for Digital Products

Digital products need special care because they’re delivered right away, and bank transfers can be risky due to slow processing times. For this reason, we recommend disabling this payment option for your digital goods.

First, make sure all your digital products are in the same category (like ‘Digital products’). If you haven’t sorted your products yet, check out our guide on how to add product tags, attributes, and categories in WooCommerce.

Then, create a new rule and name it ‘Disable Bank Transfer for Digital Products.’ Pick ‘Direct bank transfer’ as the payment method you want to disable.

Disabling bank transfers for digital products

For the condition, you can choose ‘Cart has product of category’ from the product options.

Then, select your digital products category.

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

And you’re done!

Now, when someone buys an item from the digital product category, they won’t see the bank transfer option at checkout.

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

How to Disable Specific Payment Methods for Large Orders

If you have ever processed large orders in your WooCommerce store, then you know that percentage-based payment gateway fees can take a huge chunk out of your profits.

For example, PayPal charges 2.99% + a fixed fee. On a $1,000 order, that’s around $30 in fees!

So, here’s how to set up conditional payment gateways to offer more cost-effective payment options for high-value purchases.

For this example, we’ll focus on PayPal since its percentage-based fees can become particularly expensive for small business owners handling large transactions.

First, create a new rule and name it ‘Disable PayPal for High-Value Orders.’ Select ‘PayPal’ from your WooCommerce payment methods.

Disabling PayPal for high-value orders

In ‘Below conditions determine when to disable payment methods,’ choose ‘Any one of the below rule should match.’

For the first condition, you need to pick ‘Cart Subtotal (Before discount),’ select ‘Greater or equal to,’ and enter ‘1000’ (adjust this amount based on your payment gateway fees).

For the second condition, choose ‘Cart quantity,’ select ‘Greater than or equal to,’ and enter ’10’ (or whatever number makes sense for your business).

Setting up rules for PayPal to be disabled in checkout

Now, when a customer’s order meets either condition – spending $1000 or more, OR ordering 10 or more items – PayPal won’t appear as a payment option at checkout.

You can place a test order and go to your checkout page to see if the rules work:

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

📌 Looking for more easy ways to maximize profits? Learn how to save money with our guide on how to reduce your Stripe processing fees in WordPress.

Option 3: Use Wholesale Suite to Restrict Payment Methods (For Wholesale Customers)

If you offer wholesale pricing, then you’ll likely want to set different payment gateways based on user role. You may want to offer regular customers all the standard payment methods but limit them for wholesale customers.

This way, you can maximize your profits and minimize any payment security risks.

For instance, wholesale customers often make very large purchases, and certain payment options (like PayPal) have higher fees. To avoid these steep fees cutting into profits, you could disable PayPal for wholesale users.

Similarly, you might turn off Buy Now Pay Later options so you don’t have to wait for an extended period for large sums of money (or risk never receiving them).

While you can set up conditional payment gateways using the plugin from Option 2, wholesale plugins typically already include this feature.

The Wholesale Suite plugin bundle, for example, has built-in plugins to manage payment methods based on wholesale user roles. This can improve the customer experience for your B2B buyers.

To get started, go ahead and install these WordPress plugins from the Wholesale Suite in your online store:

While the Pro version comes with a price tag, it unlocks essential wholesale features, including payment method control and tiered pricing.

You can read our detailed Wholesale Suite review for more information.

Once both plugins are active, make sure you have your wholesale store basics in place. Here are some helpful tutorials you can follow:

To restrict specific payment methods to wholesale customers, you can go to Wholesale » Settings. Then, select ‘Payment Gateway.’

Editing the Wholesale Suite's Payment Gateway settings

Next to ‘Wholesale Role,’ select the ‘Wholesale Customer’ role that the plugin has set up. Then, type in the payment gateways you want to enable.

Once done, just click ‘Add Mapping.’

Choosing what payment gateways to enable in Wholesale Suite

You should now see all of the enabled payment gateways in the table below.

Like so:

Enabled payment gateways in Wholesale Suite

Now, if the user logs in as a Wholesale Customer, they will only see this specific payment method on their checkout page.

Here’s an example:

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

Option 4: Use Advanced Coupons to Restrict Payment Methods (For Specific Coupons)

Want to offer rewards for using certain payment methods?

You can do this by creating coupons tied to specific payment options, which encourages customers to use those preferred payment methods.

While the plugin from Option 2 in this guide can handle this task, coupon plugins like Advanced Coupons include this feature by default. We love this plugin because it lets you create detailed rules and customizations for your payment-specific discounts.

First, you need to install these WordPress plugins in your WordPress admin area:

The premium version is paid, but you’ll need it to restrict payment methods and create advanced coupon rules. For more information, check out our complete Advanced Coupons review.

Next, set up your coupons by going to Coupons » Add New.

Creating a new Advanced Coupons coupon

Then, you can configure your coupon settings however you like. For detailed instructions, read our step-by-step guide on how to create smart coupons in WooCommerce.

For this tutorial, we’ll focus on creating payment-specific discounts. We’ll create a coupon code called PAYPAL20 that gives customers a 20% discount when they choose PayPal as their payment method.

Creating a PayPal-specific coupon code in Advanced Coupons

To restrict the payment method for the coupon, scroll down and find the ‘Payment Methods Restriction’ tab. Check the box that says ‘When checked, will enable payment methods restriction check when coupon is applied.’

For the ‘Type,’ you have to select ‘Allowed.’

Configuring the Payment Methods Restriction setting in Advanced Coupons

Then, in ‘Payment Methods,’ enter PayPal.

After that, feel free to continue setting up your coupon. For example, you can create an auto-apply coupon URL and share it with your potential customers.

Restricting the Advanced Coupons coupon to PayPal

Once you’re finished configuring these settings, click ‘Update’ or ‘Publish’ to save your coupon.

It’s as simple as that!

Saving changes to the Advanced Coupons coupon

When customers use this coupon, they’ll see PayPal as the only payment method.

The discount will also be applied to their order summary.

Applying the PayPal-specific Advanced Coupons coupon

Option 5: Add Custom Code to Disable Payment Methods (Advanced + No Plugin)

If you don’t want to use a dedicated payment plugin, then you can also get the same results with several lines of custom code. We’ll show you how to disable payment methods based on two common scenarios: customer location (country) and cart total.

Keep in mind that this approach is more technical than the previous options. It requires adding code to your functions.php file, which controls how your WordPress website behaves.

However, we don’t recommend editing your functions.php file directly, as making even a small mistake can break your entire website. Instead, we suggest using WPCode, which is a code snippet manager that helps you add custom code safely.

While it is a plugin, it’s a lightweight tool for many customizations beyond payment methods, such as adding tracking codes, custom functions, or analytics.

You can read our complete WPCode review and our guide on the most useful WordPress code snippets for beginners to see what you can do with WPCode.

Before we start, we need to know the ID of the payment gateway that we want to disable. To do this, just go to WooCommerce » Settings and switch to the ‘Payments’ tab.

Configuring the WooCommerce payments settings

Then, hover your cursor over one of the payment methods.

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

The part at the end that follows &section= is your payment gateway ID. So, for example, if you hover over the PayPal option, then the ID is ppcp-gateway.

PayPal payment gateway ID

Make sure to take note of this information, as you will need it in the next steps.

Now, install WPCode on your WordPress site. You can read our step-by-step guide on how to install a WordPress plugin for detailed instructions.

Next, go to Code Snippets » + Add Snippet. Then, choose ‘Add Your Custom Code (New Snippet)’ and click on the ‘+ Add Custom Snippet’ button.

Add Custom Snippet button in WPCode

After that, you’ll need to choose a code type.

For this tutorial, select ‘PHP Snippet.’

Choosing PHP snippet in WPCode

Now, let’s look at two code snippets you can add to disable specific payment methods in WooCommerce.

How to Disable Payment Methods Based on Country

To do this, you need to give your code snippet a name like ‘Disable [Payment Method Name] for [Country Name].’

After that, you can paste the code snippet below into the ‘Code Preview’ box:

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

function customize_payment_gateway_based_on_country( $available_gateways ) {

    // Check if we're in the admin area or if the WooCommerce customer object is not available.
    // If either is true, return the unmodified gateways.
    if ( is_admin() || ! WC()->customer ) {
        return $available_gateways;
    }
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Payment Gateway ID
    //
    // Replace 'your_gateway_id' with the ID of the payment gateway you want to target.
    // For example:
    //   - To target Stripe, replace with 'stripe'
    //   - To target PayPal, replace with 'paypal'
    //
    $gateway_id_placeholder = 'your_gateway_id';
    // -----------------------------------------------------------------------
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Country Code
    //
    // Replace 'XX' with the desired country code where you want to disable the gateway.
    // Country codes are based on ISO 3166-1 alpha-2.
    // For example:
    //   - To target the United States, use 'US'
    //   - To target the United Kingdom, use 'GB'
    //
    $target_country_code = 'XX';
    // -----------------------------------------------------------------------

    // Check if the specified payment 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();

        // Compare the customer's billing country with the target country code.
        if ( $customer_country === $target_country_code ) {
            // If the customer's country matches the target, remove the payment gateway.
            unset( $available_gateways[ $gateway_id_placeholder ] );
        }
    }
    
    // Return the (possibly modified) list of available gateways.
    return $available_gateways;
}

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

First, find the $gateway_id_placeholder variable and replace ‘your_gateway_id’ with the ID of your payment gateway.

Find the $target_country_code variable and replace ‘XX’ with your target country’s two-letter code. For example:

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

So, let’s say you want to disable direct bank transfers for customers in the United States. If so, then your code should look like this:

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

function customize_payment_gateway_based_on_country( $available_gateways ) {

    // Check if we're in the admin area or if the WooCommerce customer object is not available.
    // If either is true, return the unmodified gateways.
    if ( is_admin() || ! WC()->customer ) {
        return $available_gateways;
    }
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Payment Gateway ID
    //
    // Replace 'your_gateway_id' with the ID of the payment gateway you want to target.
    // For example:
    //   - To target Stripe, replace with 'stripe'
    //   - To target PayPal, replace with 'ppcp-gateway'
    //
    $gateway_id_placeholder = 'bacs';
    // -----------------------------------------------------------------------
    
    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Country Code
    //
    // Replace 'XX' with the desired country code where you want to disable the gateway.
    // Country codes are based on ISO 3166-1 alpha-2.
    // For example:
    //   - To target the United States, use 'US'
    //   - To target the United Kingdom, use 'GB'
    //
    $target_country_code = 'US';
    // -----------------------------------------------------------------------

    // Check if the specified payment 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();

        // Compare the customer's billing country with the target country code.
        if ( $customer_country === $target_country_code ) {
            // If the customer's country matches the target, remove the payment gateway.
            unset( $available_gateways[ $gateway_id_placeholder ] );
        }
    }
    
    // Return the (possibly modified) list of available gateways.
    return $available_gateways;
}

This code will hide the direct bank transfer option when customers from the United States visit your checkout page.

Once you’ve customized these parts, switch the toggle from ‘Inactive’ to ‘Active,’ then click ‘Save Snippet.’

Disabling payment methods by country with WPCode

Now, you can go ahead and place a test order to see if the code works.

Here’s what our checkout page looks like when we use the sample code snippet for disabling PayPal for US-based customers:

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

How to Disable Payment Methods Based on Cart Total

First, create a new code snippet and give it a descriptive name, like ‘Disable [Payment Method] for High-Value Orders.’

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

// Hook our custom function into the WooCommerce available payment 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 ) {
    // Check if we're in the admin area. If so, return the unmodified gateways to avoid issues in the backend.
    if ( is_admin() ) {
        return $available_gateways;
    }

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

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Minimum Cart Subtotal
    // Replace 123 with the desired minimum cart subtotal above which you want to disable the gateway.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Payment Gateway ID
    // Replace 'your_gateway_id' with the ID of the payment gateway you want to target.
    // For example:
    //   - To target Stripe, replace with 'stripe'
    //   - To target PayPal, replace with 'ppcp-gateway'
    // -----------------------------------------------------------------------


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

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

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

Simply replace ‘123’ with your desired minimum amount (don’t include currency symbols).

Next, find ‘your_gateway_id’ and replace it with your payment gateway ID like before.

So, if you want to disable PayPal for orders over $100, you would set the value to ‘100’ and use ‘ppcp-gateway’ as the gateway ID.

Here’s what the full code snippet would look like:

// Hook our custom function into the WooCommerce available payment 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 ) {
    // Check if we're in the admin area. If so, return the unmodified gateways to avoid issues in the backend.
    if ( is_admin() ) {
        return $available_gateways;
    }

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

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 1: Minimum Cart Subtotal
    // Replace 123 with the desired minimum cart subtotal above which you want to disable the gateway.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // CUSTOMIZATION 2: Payment Gateway ID
    // Replace 'your_gateway_id' with the ID of the payment gateway you want to target.
    // For example:
    //   - To target Stripe, replace with 'stripe'
    //   - To target PayPal, replace with 'ppcp-gateway'
    // -----------------------------------------------------------------------


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

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

Once you’ve customized these parts, switch the toggle from ‘Inactive’ to ‘Active.’

Then, click ‘Save Snippet.’

Disabling PayPal for high-value orders with WPCode

Finally, try creating a test order to see if the code works.

Here’s what you should see on your checkout page if you disable PayPal for orders above $100:

Example of disabling PayPal for high-value orders with WPCode

More Ways to Improve Your WooCommerce Store

Now that you know how to manage payment methods in WooCommerce, here are other things you can do to build a better online store:

🚨 Ready to take your online store to the next level? Let our WPBeginner Pro Services team help you build a professional WooCommerce store. We’ll set up your payment gateways, optimize your checkout process, and ensure your store runs smoothly. Plus, you’ll get a dedicated project manager to oversee every detail of your store setup.

Book a Free Consultation Call With Our Team Today!

We hope this article has helped you learn how to disable payment methods in WooCommerce. You may also want to check out our guide on how to add a free shipping bar in WooCommerce and our expert picks of the best Authorize.net plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Disable Payment Methods in WooCommerce (Ultimate Guide) first appeared on WPBeginner.

]]>
https://www.wpbeginner.com/wp-tutorials/how-to-disable-payment-methods-in-woocommerce/feed/ 0