Restrict Payment Methods For WooCommerce Documentation

Table of Contents

1. Installation & Setup

Requirements

  • WordPress 5.0 or higher
  • WooCommerce (latest version recommended)
  • PHP 7.4 or higher

Installing the Free Version

  1. Log in to your WordPress admin dashboard.
  2. Go to Plugins → Add New.
  3. Search for Restrict Payment Methods For WooCommerce.
  4. Click Install Now, then click Activate.

Installing the Pro Version

  1. Purchase the Pro plugin from codesmade.com.
  2. Download the .zip file from your account.
  3. Go to Plugins → Add New → Upload Plugin.
  4. Choose the downloaded .zip file and click Install Now.
  5. Click Activate Plugin.

Note: You do not need the free version installed to use Pro. The Pro plugin is fully standalone.

Accessing the Settings

After activation, go to Payment Gateway Rules → Add Rule to start creating rules.


2. How to Create Rules

rule is a set of conditions that determines when a payment gateway should be shown or hidden at checkout.

Step 1 – Open the Rules Panel

Go to Payment Gateway Rules → Add Rule.

Step 2 – Add a New Rule

Click the Add Rule button. A new rule block will appear on the screen.

Step 3 – Select a Payment Gateway

From the rule block, choose which payment gateway(s) this rule should apply to. You can select one or multiple gateways (e.g. PayPal, Stripe, Cash on Delivery).

Step 4 – Set the Action

Choose whether to Show or Hide the selected gateway(s) when the conditions are met.

Step 5 – Add Conditions

Click Add Condition to add one or more conditions to the rule. Each condition defines a specific requirement that must be true for the rule to apply.

You can add multiple conditions and group them using AND or OR logic:

  • AND – All conditions in the group must match.
  • OR – At least one condition in the group must match.

Step 6 – Save

Click Save Changes. The rule is now active and will apply at checkout.

Managing Existing Rules

  • You can create unlimited rules.
  • Rules can be enabled or disabled individually without deleting them.
  • Rules can be deleted at any time from the rules panel.

Example Rule

Hide “Cash on Delivery” when the cart subtotal is greater than $500 AND the user is a guest.

  1. Action: Hide → Cash on Delivery
  2. Condition 1: Cart subtotal → greater than → 500
  3. Logic: AND
  4. Condition 2: User login status → Guest

3. All Conditions Explained

Conditions let you define exactly when a rule should trigger. Below is a full reference for every available condition.

Free Conditions

Cart Subtotal

Triggers based on the cart subtotal amount (before tax and shipping).

  • Operators: equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to
  • Example: Show PayPal only if subtotal is greater than or equal to $50.

Cart Quantity

Triggers based on the total number of items in the cart.

  • Operators: equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to
  • Example: Hide Cash on Delivery if cart quantity is greater than 10.

Specific Products

Triggers when a specific product is present (or not present) in the cart.

  • Operators: contains, does not contain
  • Example: Hide Bank Transfer if a specific product ID is in the cart.

User Login Status

Triggers based on whether the customer is logged in or browsing as a guest.

  • Values: Logged In, Guest
  • Example: Show Bank Transfer only for logged-in users.

User Roles

Triggers based on the WordPress role assigned to the customer.

  • Example roles: Administrator, Customer, Subscriber, Wholesale Customer
  • Example: Show a specific gateway only for users with the Wholesale role.

Specific Users

Triggers for one or more specific WordPress user accounts by user ID or username.

  • Example: Enable a gateway only for a known B2B customer account.

Shipping Method

Triggers based on the shipping method selected by the customer at checkout.

  • Example: Hide Cash on Delivery when Free Shipping is selected.

Billing Country / State / City

Triggers based on the customer’s billing address location.

  • Example: Restrict PayPal for customers billing from a specific country.

Shipping Country / State / City

Triggers based on the customer’s shipping address location.

  • Example: Show local payment method only when shipping to a specific city.

Day of Week

Triggers based on the current day of the week when the customer is checking out.

  • Values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
  • Example: Show Stripe only on weekdays (Monday–Friday).

Date Range

Triggers when the current date falls within a defined date range.

  • Example: Hide a gateway during a holiday period or promotional window.

Pro Conditions

The following conditions are available in the Pro version only.

Shipping Class

Triggers based on the WooCommerce shipping class assigned to products in the cart.

  • Example: Hide Cash on Delivery when a “Heavy Freight” shipping class product is in the cart.

Product Type

Triggers based on the WooCommerce product type of items in the cart.

  • Values: Simple, Variable, Virtual, Downloadable, Grouped, External
  • Example: Hide Cash on Delivery when a virtual or downloadable product is in the cart.

Product Stock Status

Triggers based on the stock status of products in the cart.

  • Values: In Stock, Out of Stock, On Backorder
  • Example: Restrict certain gateways when a backordered item is in the cart.

Billing Email

Triggers based on the email address entered in the billing field at checkout.

  • Operators: is, is not, contains, does not contain
  • Example: Enable a gateway only for customers with a specific company email domain.

Shipping Email

Triggers based on the email address entered in the shipping field at checkout.

  • Operators: is, is not, contains, does not contain
  • Example: Apply a rule when the shipping recipient email matches a known address.

Product Categories

Triggers when a product belonging to a specific category is present in the cart.

  • Example: Show Bank Transfer only when a product from the “Wholesale” category is in the cart.

Product Tags

Triggers when a product with a specific tag is present in the cart.

  • Example: Hide a gateway when a product tagged “fragile” is in the cart.

Product Brands

Triggers when a product from a specific brand is present in the cart.

  • Example: Show a dedicated gateway only for orders containing products from a partner brand.

4. Frequently Asked Questions

Does the plugin work with all payment gateways?

Yes. The plugin supports all WooCommerce-compatible payment gateways, including Stripe, PayPal, Cash on Delivery, Bank Transfer, and any custom gateway that follows WooCommerce’s payment API standards.

Can I create multiple rules?

Yes. Both the free and Pro versions support unlimited rules. Each rule is independent and can target different gateways and conditions.

Can I use AND and OR logic together?

Yes. You can combine multiple condition groups within a single rule using AND/OR logic for complex checkout scenarios.

Do I need the free version installed to use Pro?

No. The Pro plugin is fully standalone. Simply install and activate the Pro version directly — no free version required.

Will it conflict with other WooCommerce plugins?

The plugin is built to follow standard WooCommerce hooks and filters. It is compatible with most WooCommerce extensions including Subscriptions, Memberships, and popular page builders.

What happens if no conditions are met?

If none of the rule conditions are met, the rule does not apply and all gateways remain visible as per your default WooCommerce payment settings.

Can I disable a rule without deleting it?

Yes. Each rule has an enable/disable toggle so you can deactivate it temporarily without losing your configuration.

Does it work with WooCommerce HPOS (High-Performance Order Storage)?

Yes. The plugin is compatible with WooCommerce’s High-Performance Order Storage feature.