Conditional Shipping and Payments

Conditional Shipping and Payments allows you to create conditional rules to restrict the payment gateways, shipping methods and shipping countries/states available at checkout.

This guide will help you get up to speed with setting up checkout restrictions. It also includes a handy reference of all conditions available for building complex rules, organized by restriction type.

The extension does not create any new shipping/payment methods for you. You can use it to conditionally exclude existing shipping/payment methods based on various parameters, such as: the selected billing/shipping country/state, the total package/order weight, package/cart contents, the current customer/user role or e-mail, and more.

Installation ↑ Back to top

  1. Download the .zip file from your WooCommerce account.
  2. Go to WordPress Admin > Plugins > Add New.
  3. Click Upload Plugin at the top.
  4. Choose File and select the .zip file you downloaded in Step 1.
  5. Click Install Now and Activate the extension.

How it Works ↑ Back to top

Depending on how you have set up WooCommerce, the checkout page of your store probably offers at least a few:

  • Country/State options
  • Shipping Method options
  • Payment Gateway options

Conditional Shipping and Payments allows you to conditionally hide/remove some of these options, or display a helpful notice when a customer attempts to use an excluded option. This is possible by creating exclusion rules that may include conditional logic. These rules are called Restrictions.

Some examples:

  • Disable the Direct Bank Transfer payment option when the order total is below $1000.
  • Enable the Direct Bank Transfer payment option for specific customers or customer roles only.
  • Disable the PayU payment option if the selected billing country is not Poland.
  • Disable the Express Mail Europe add-on flat-rate shipping option if the selected shipping country is not a European country and the order total is lower than $50.
  • Disable the Continental US Express Mail add-on flat-rate shipping option when customers select a non-continental US State.
  • Prevent orders from being shipped abroad if they contain products from the Fresh Foods category.
  • Prevent products in the Batteries category from being shipped with the Royal Mail shipping option.
Some great information about setting up WooCommerce can be found at Configuring WooCommerce Settings. The Shipping Methods archive is particularly useful if you want to learn more about Shipping Zones and Shipping Methods. If you are just starting out with Payment Gateways, Core Payment Options lists all Payment Gateways included in WooCommerce out-of-the-box. Finally, have a look at Payment Gateway Extensions — a handy guide that will help you pick the one(s) you need.

Getting Started ↑ Back to top

The extension lets you create two types of Restrictions:

  • Global Restrictions
  • Product-level Restrictions

Global Restrictions ↑ Back to top

Global restrictions are the most flexible, since they are not associated with specific products — they are always evaluated during checkout. Global restrictions are created and managed from a dedicated Restrictions tab found by navigating to WooCommerce > Settings > Restrictions:

To create global restrictions, navigate to Settings > Restrictions.

There are 3 sections dedicated to managing restrictions for:

  • Shipping Countries & States,
  • Payment Gateways and
  • Shipping Methods.

Here’s a Payment Gateway restriction example:

A global Payment Gateway restriction.

This global restriction disables the Direct Bank Transfer option if an order has a total value lower than $1000.

Note that you can add multiple rules, even for the same restriction type. For example, you can create multiple restrictions to exclude the same Payment Gateway, with different conditions each time.

Product-level Restrictions ↑ Back to top

Product-level Restrictions are exclusion rules associated with specific products. They are evaluated for each product found in the cart during checkout and can be created from the Product Data > Restrictions tab.

The following example shows you how to associate a Shipping Countries & States restriction with a Rechargeable Lithium Battery product. The Restriction prevents customers from choosing the United States as a shipping destination for this product, unless the order total is higher than $100.

A product-level restriction.

You can create 3 types of product-level restrictions for:

  • Payment Gateways
  • Shipping Methods
  • Shipping Countries & States

As with global restrictions, you can create multiple rules for the same restriction type.

Product-level restrictions can be created for all types of shipping and payment options.

Conditions ↑ Back to top

Every restriction can be accompanied by some conditions, which determine whether the restriction will be activated. A restriction is activated only if all defined conditions match at the same time.

To understand this better, here’s an example:

A restriction with multiple conditions.

This restriction excludes all available shipping methods if:

  • an order contains products from the Batteries category,
  • the order is shipped to the United States,
  • the order total is under $100.

The restriction works only when all 3 conditions match. Otherwise, all shipping methods are available at checkout, as usual.

Checkout notice generated by a matching restriction.

Restrictions Reference ↑ Back to top

Payment Gateways ↑ Back to top

Payment Gateway restrictions allow you to conditionally disable/exclude payment gateways.

Global Restrictions

To create a global Payment Gateway restriction:

  1. Navigate to WooCommerce > Settings > Restrictions > Payment Gateways.
  2. Click the Add Restriction button.
  3. Configure options.

Payment Gateway restrictions include the following options:

  1. Short Description — identifies this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Exclude Gateways — the Payment Gateways disabled by this new rule.
  3. Show Excluded — when enabled, excluded Payment Gateways are visible at checkout. Select this option if you prefer to have a notice displayed when customers choose an excluded Payment Gateway.
  4. Custom Notice — custom notice displayed to customers when choosing an excluded Payment Gateway. Overrides the default notice.

Use Conditions to introduce conditional logic into the restrictions you create. The following table provides a summary of all Conditions available in global Payment Gateway restrictions:

Condition Modifier Description
Backorder in cart Matches if the cart contains at least one product on backorder.
not in cart Matches if the cart does not contain any product on backorder.
all cart items Matches if the cart contains only products on backorder.
not all cart items Matches if the cart contains at least one product that is not on backorder.
Billing Country is Matches if one of the listed billing countries is selected at checkout.
is not Matches if none of the listed billing countries is selected at checkout.
Category in cart Matches if the cart contains at least one product from a listed category.
not in cart Matches if the cart does not contain any product from a listed category.
all cart items Matches if the cart contains only products from the listed categories.
not all cart items Matches if the cart contains at least one product that does not belong in any of the listed categories.
Coupon Code used Matches if a listed coupon is applied in the cart.
not used Matches if none of the listed coupons is applied in the cart.
Customer e-mail is Matches if the list of e-mails includes the current customer’s e-mail.
e-mail is not Matches if the list of e-mails does not include the current customer’s e-mail.
Customer Role is Matches if the listed roles include the current customer’s role.
is not Matches if the listed roles do not include the current customer’s role.
Order Total < Matches if the checkout order total is lower (<) than this value.
>= Matches if the checkout order total is greater (>=) than this value.
Package Item Count < Matches if the quantity of items in a package is lower (<) than this value.
>= Matches if the quantity of items in a package is greater (>=) than this value.
Shipping Class in cart Matches if the cart contains at least one product from a listed shipping class.
not in cart Matches if the cart does not contain any product from a listed shipping class.
all cart items Matches if the cart contains only products from the listed shipping classes.
not all cart items Matches if the cart contains at least one product that does not belong in any of the listed shipping classes.
Shipping Country is Matches if the listed shipping countries include the shipping country selected at checkout. If any States/Regions are specified, the condition will match only if a listed State/Region is selected at checkout, as well.
is not Matches if the listed shipping countries do not include the shipping country selected at checkout. If one of the listed shipping countries is selected at checkout and States/Regions are specified, the condition will match only if a non-listed State/Region is selected.
Shipping Method is Matches if one of the listed shipping methods is selected at checkout.
is not Matches if none of the listed shipping methods is selected at checkout.
Shipping Postcode is Matches if the shipping postcode entered at checkout is equal to the specified value, or included in the specified range.
is not Matches if the shipping postcode entered at checkout is not equal to the specified value, or not included in the specified range.
Membership Plan 1 active exists Matches if the current customer is a member of one of the listed Membership Plans.
all inactive Matches if the current customer is not a member of any of the listed Membership Plans.
inactive exists Matches if the current customer is not a member of at least one of the listed Membership Plans.
all active Matches if the current customer is a member of all listed Membership Plans.
Recurring Item 2 in cart Matches if the cart contains at least one subscription product.
not in cart Matches if the cart does not contain any subscription products.
all in cart Matches if the cart contains only subscription products.
not all in cart Matches if the cart contains at least one non-subscription product.
Currency 3 is Matches if one of the listed currencies is currently active.
is not Matches if none of the listed currencies is currently active.

1 Available if WooCommerce Memberships is installed and activated.
2 Available if WooCommerce Subscriptions is installed and activated.
3 Available if WooCommerce Multi-Currency is installed and activated.

Product-level Restrictions

Product-level Payment Gateway restrictions are useful if you want to exclude one or more Payment Gateways when a specific product is in the cart. To add a new product-level Payment Gateway restriction:

  1. Navigate to Product Data > Restrictions.
  2. Choose the Payment Gateways restriction type.
  3. Click the Add Restriction button.
  4. Configure options.

Product-level restrictions include the same options as the ones found in global restrictions of the same type. However, the available Conditions are slightly different:

  1. Some conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new Product Quantity condition.
Condition Modifier Description
Product Quantity < Matches if the cart item quantity of the product is lower (<) than this value.
>= Matches if the cart item quantity of the product is higher (>=) than this value.

Shipping Methods ↑ Back to top

Shipping Method restrictions allow you to conditionally disable/exclude shipping methods — or, shipping method instances added to specific Shipping Zones when using WooCommerce version 2.6+.

Global Restrictions

To create a global Shipping Method restriction:

  1. Navigate to WooCommerce > Settings > Restrictions > Shipping Methods.
  2. Click the Add Restriction button.
  3. Configure options.

Shipping Method restrictions include the following options:

  1. Short Description — identifies this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Exclude Methods — the Shipping Methods disabled by this new rule.
  3. Exclude Rate IDs — advanced option for excluding Shipping Method options generated by external APIs.
  4. Show Excluded — when enabled, excluded Shipping Methods are visible at checkout. Select this option if you prefer to have a notice displayed when customers choose an excluded Shipping Method.
  5. Custom Notice — custom notice displayed to customers when choosing an excluded Shipping Method. Overrides the default notice.

Use Conditions to introduce conditional logic into the restrictions you create. The following table provides a summary of all Conditions available in global Shipping Method restrictions:

Condition Modifier Description
Backorder in package Matches if the package contains at least one product on backorder.
not in package Matches if the package does not contain any product on backorder.
all package items Matches if the package contains only products on backorder.
not all package items Matches if the package contains at least one product that is not on backorder.
Billing Country is Matches if one of the listed billing countries is selected at checkout.
is not Matches if none of the listed billing countries is selected at checkout.
Cart Total < Matches if the cart total (after discounts, including taxes) is lower (<) than this value.
>= Matches if the cart total (after discounts, including taxes) is greater (>=) than this value.
Category in package Matches if the package contains at least one product from a listed category.
not in package Matches if the package does not contain any product from a listed category.
all package items Matches if the package contains only products from the listed categories.
not all package items Matches if the package contains at least one product that does not belong in any of the listed categories.
Coupon Code used Matches if a listed coupon is applied in the cart.
not used Matches if none of the listed coupons is applied in the cart.
Customer e-mail is Matches if the list of e-mails includes the current customer’s e-mail.
e-mail is not Matches if the list of e-mails does not include the current customer’s e-mail.
Customer Role is Matches if the listed roles include the current customer’s role.
is not Matches if the listed roles do not include the current customer’s role.
Package Item Count < Matches if the quantity of items in the package is lower (<) than this value.
>= Matches if the quantity of items in the package is greater (>=) than this value.
Package Total < Matches if the package total is lower (<) than this value.
>= Matches if the package total is greater (>=) than this value.
Package Weight < Matches if the total package weight is lower (<) than this value.
>= Matches if the total package weight is greater (>=) than this value.
Shipping Class in package Matches if the package contains at least one product from a listed shipping class.
not in package Matches if the package does not contain any product from a listed shipping class.
all package items Matches if the package contains only products from the listed shipping classes.
not all package items Matches if the package contains at least one product that does not belong in any of the listed shipping classes.
Shipping Country is Matches if the listed shipping countries include the shipping country selected at checkout. If any States/Regions are specified, the condition will match only if a listed State/Region is selected at checkout, as well.
is not Matches if the listed shipping countries do not include the shipping country selected at checkout. If one of the listed shipping countries is selected at checkout and States/Regions are specified, the condition will match only if a non-listed State/Region is selected.
Shipping Postcode is Matches if the shipping postcode of the package is equal to the specified value, or included in the specified range.
is not Matches if the shipping postcode of the package is not equal to the specified value, or not included in the specified range.
Membership Plan 1 active exists Matches if the current customer is a member of one of the listed Membership Plans.
all inactive Matches if the current customer is not a member of any of the listed Membership Plans.
inactive exists Matches if the current customer is not a member of at least one of the listed Membership Plans.
all active Matches if the current customer is a member of all listed Membership Plans.
Recurring Item 2 in package Matches if the package contains at least one subscription product.
not in package Matches if the package does not contain any subscription products.
all in package Matches if the package contains only subscription products.
not all in package Matches if the package contains at least one non-subscription product.
Currency 3 is Matches if one of the listed currencies is currently active.
is not Matches if none of the listed currencies is currently active.

1 Available if WooCommerce Memberships is installed and activated.
2 Available if WooCommerce Subscriptions is installed and activated.
3 Available if WooCommerce Multi-Currency is installed and activated.

Product-level Restrictions

Product-level Shipping Method restrictions are useful if you want to exclude one or more Shipping Methods when a specific product is in the cart. To add a new product-level Shipping Method restriction:

  1. Navigate to Product Data > Restrictions.
  2. Choose the Shipping Methods restriction type.
  3. Click the Add Restriction button.
  4. Configure options.

Product-level restrictions include the same options as the ones found in global restrictions of the same type. However, the available Conditions are slightly different:

  1. Some conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new Product Quantity condition.
Condition Modifier Description
Product Quantity < Matches if the cart item quantity of the product is lower (<) than this value.
>= Matches if the cart item quantity of the product is higher (>=) than this value.

Shipping Countries & States ↑ Back to top

Shipping Country/State restrictions allow you to conditionally prevent customers from checkout out when specific shipping countries or states are selected.

Global Restrictions

To create a global restriction:

  1. Navigate to WooCommerce > Settings > Restrictions > Shipping Countries & States.
  2. Click the Add Restriction button.
  3. Configure options.

Shipping Country/State restrictions include the following options:

  1. Short Description — identifies this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Exclude Countries — the Shipping Countries excluded by this rule.
  3. Exclude States/Regions — the Shipping States/Regions excluded by this rule.
  4. Custom Notice — custom notice displayed to customers when choosing an excluded Shipping Country/State. Overrides the default notice.

Use Conditions to introduce conditional logic into the restrictions you create. The following table provides a summary of all Conditions available in global Shipping Method restrictions:

Condition Modifier Description
Backorder in package Matches if a package contains at least one product on backorder.
not in package Matches if a package does not contain any product on backorder.
all package items Matches if a package contains only products on backorder.
not all package items Matches if a package contains at least one product that is not on backorder.
Cart Total < Matches if the cart total (after discounts, including taxes) is lower (<) than this value.
>= Matches if the cart total (after discounts, including taxes) is greater (>=) than this value.
Category in package Matches if a package contains at least one product from a listed category.
not in package Matches if a package does not contain any product from a listed category.
all package items Matches if a package contains only products from the listed categories.
not all package items Matches if a package contains at least one product that does not belong in any of the listed categories.
Customer e-mail is Matches if the list of e-mails includes the current customer’s e-mail.
e-mail is not Matches if the list of e-mails does not include the current customer’s e-mail.
Customer Role is Matches if the listed roles include the current customer’s role.
is not Matches if the listed roles do not include the current customer’s role.
Package Item Count < Matches if the quantity of items in a package is lower (<) than this value.
>= Matches if the quantity of items in a package is greater (>=) than this value.
Package Total < Matches if a package total is lower (<) than this value.
>= Matches if a package total is greater (>=) than this value.
Shipping Class in package Matches if a package contains at least one product from the shipping classes included here.
not in package Matches if a package contains does not contain any product from the shipping classes included here.
all package items Matches if a package contains only products from the shipping classes included here.
not all package items Matches if a package contains at least one product not from the shipping classes included here.
Membership Plan 1 active exists Matches if the current customer is a member of one of the listed Membership Plans.
all inactive Matches if the current customer is not a member of any of the listed Membership Plans.
inactive exists Matches if the current customer is not a member of at least one of the listed Membership Plans.
all active Matches if the current customer is a member of all listed Membership Plans.
Recurring Item 2 in package Matches if a package contains at least one subscription product.
not in package Matches if a package does not contain any subscription products.
all in package Matches if a package contains only subscription products.
not all in package Matches if a package contains at least one non-subscription product.
Currency 3 is Matches if one of the listed currencies is currently active.
is not Matches if none of the listed currencies is currently active.

1 Available if WooCommerce Memberships is installed and activated.
2 Available if WooCommerce Subscriptions is installed and activated.
3 Available if WooCommerce Multi-Currency is installed and activated.

Product-level Restrictions

Product-level Shipping Country/State restrictions are useful if you want to exclude one or more Shipping Countries/States when a specific product is in the cart. To add a new product-level restriction:

  1. Navigate to Product Data > Restrictions.
  2. Choose the Shipping Countries & States restriction type.
  3. Click the Add Restriction button.
  4. Configure options.

Product-level restrictions include the same options as the ones found in global restrictions of the same type. However, the available Conditions are slightly different:

  1. Some conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new Product Quantity condition.
Condition Modifier Description
Product Quantity < In effect if the cart item quantity of the product involved is lower (<) than this value.
>= In effect if the cart item quantity of the product involved is higher (>=) than this value.

Examples ↑ Back to top

1. Conditional Flat Rates ↑ Back to top

The extension can be used to conditionally disable entire shipping methods, or exclude method instances attached to specific Shipping Zones.

Here, it is assumed that the General Options of WooCommerce have been set to use 3 Selling Locations – Canada, Mexico and the United States (including non-continental States).

2 Shipping Zones have been created:

Zone Name Destinations
Zone A Continental US States only.
Zone B Canada, Mexico and non-continental US States.

The objective is to offer 2 shipping rate options per Zone, depending on order weight:

Rate Name Zone Weight Rate
Zone A Standard Zone A Less than 2 kg. $7
Zone A Heavy Zone A More than 2 kg but no higher than 5 kg. $14
Zone B Standard Zone B Less than 2 kg. $10
Zone B Heavy Zone B Between 2 kg but no higher than 5 kg. $17

Follow the WooCommerce Shipping Zones documentation to:

  1. Create the 2 Zones.
  2. Add 2 instances of the Flat-Rate shipping method in each Zone. Use the data from the previous table to fill in the Method Title and Cost fields of each Flat-Rate method instance you create.
  3. Create the necessary Shipping Method restrictions by navigating to Settings > Restrictions > Shipping Methods.

Here’s an overview of the required restrictions, 3 in total:

Example 1 – Restrictions summary

Rule #1 – Exclude Zone A Standard and Zone B Standard rates if weight >= 2kg:

Example 1 – Rule #1: Exclude Zone A/B if weight >= 2kg.

Rule #2 – Exclude Zone A Heavy and Zone B Heavy rates if weight < 2kg:

Example 1 – Rule #2: Exclude Zone A/B Heavy if weight < 2kg.

Rule #3 – 5kg weight limit:

Example 1 – Rule #3: 5kg weight limit.

Example 2. Shipping Terms of Service Compliance ↑ Back to top

Most courier companies require you to comply to their Terms of Service for shipping various types of products, e.g. products labelled as “dangerous goods”. Depending on the shipping destination, shipping method and package contents, a courier company may refuse to ship an order, or may have specific pricing, packaging, handling or forwarding requirements.

In the following example, a restriction excludes some shipping methods if a shipping package contains products from the Batteries category:

Example 2 – Exclude shipping methods from multiple Zones when shipping Batteries.

Example 3. Customs Import Regulations ↑ Back to top

Some countries/states do not permit certain types of goods to be imported – tobacco and vaping gear, for instance, are prohibited in many countries. If your day-to-day routine includes cancelling orders and sending refunds due to customs import restrictions, it might be a good idea to consider a more effective, transparent approach that: i) prevents customers from checking out when choosing a restricted shipping country, and ii) gives them a suitable explanation. Shipping Country & State restrictions are very effective here as they handle both requirements gracefully.

Use Shipping Country/State rules to implement restrictions that arise from policies, laws or regulations associated with the chosen shipping country or state. When possible, use custom notices to direct customers to alternative courses of action.

Example 4. Payment Gateway Terms of Service Compliance ↑ Back to top

Depending on what you are selling and how, compliance with Payment Gateway terms and conditions may require some effort on your part. For instance, some payment service providers may:

  • refuse to process payments for specific types of products, or
  • require merchants to present some proof-of-shipment in order to resolve disputes that may arise between buyers/sellers, such as a shipment tracking IDs.

The extension allows you to define Payment Gateway restrictions based on various conditions, including the chosen Shipping Method(s). In the following example, a Payment Gateway restriction is created to exclude PayPal when selecting an Unregistered Postal Delivery shipping method:

Example 4 – Exclude PayPal when shipping via unregistered Snail Mail.

FAQ ↑ Back to top

How can I exclude specific shipping rates supplied by major courier APIs? For example, ‘FedEx Ground’ only? ↑ Back to top

To calculate shipping rates, some Shipping Methods may connect WooCommerce to an external API that fetches shipping costs based on the dimensions and weights of all items contained in a customer’s cart. The returned rates often include options for different services, such as Ground/Air, or Standard/Express. Often these rates are not known to WooCommerce in advance, and you may find that Conditional Shipping and Payments does not make them individually available for exclusion.

As a workaround, the extension allows you to exclude Shipping Rates by ID. However, you will need to do some extra work to find the IDs associated with the shipping options you want to exclude. To find the rate ID associated with a shipping method option:

  1. Activate your browser’s Developer Tools/Console. If you are using Firefox, press Ctrl+Shift+K (or Cmd+Option+K on OS X) to toggle the console.
  2. Right-click on the shipping option you want to exclude, and choose Inspect Element.
  3. Copy the value seen in the following screenshot. In most cases, it should be something like fedex:FEDEX_GROUND
  4. Paste it into the Excluded Rate IDs field.

Questions & Support ↑ Back to top

Have a question before you buy? Please fill out this pre-sales form.
Already purchased and need assistance? Get in touch with us via the Help Desk!

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top