Conditional Shipping and Payments

Conditional Shipping and Payments gives you complete control over the payment gateways, shipping methods and shipping countries/states available to customers at checkout. It allows you to create multiple exclusion rules based on conditions that can be combined together to implement complex restrictions.

This guide will introduce you to the basic concepts behind Conditional Shipping and Payments. It also includes some hands-on examples to help you get a clearer idea of how it works.

The extension will not create any new payment gateways for you. However, you can use it to conditionally exclude existing payment gateways based on conditions such as the selected shipping method, selected billing/shipping country and state, cart/order total, user role, user e-mail, and more.
The extension will not create any new shipping methods for you. However, it allows you to conditionally disable existing shipping methods — or shipping method instances attached to specific Shipping Zones, when using WooCommerce 2.6+. Exclusion rules can be combined with conditions, such as the selected billing/shipping country/state (better handled using Shipping Zones in WooCommerce 2.6+), package weight, cart contents, customer role, etc. For details, see Example 1. Note that if you need to create very complex shipping rules and rates, it is strongly recommended to use the Table Rate Shipping extension, which was made specifically for this purpose.

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

When a customer checks out, they are normally presented with some country/state options, some shipping method options and, finally, some payment options, according to how you have set up WooCommerce.

You can find some general information about setting up WooCommerce here, while this reference is particularly useful if you want to learn more about shipping methods. Payment options included in WooCommerce are described here, and there is also a handy guide about Premium Payment Gateway options.

Conditional Shipping and Payments works by excluding some of these options, or by showing a helpful notice when a customer attempts to use an excluded option.

To make this possible, the extension introduces Restrictions. Every restriction is an exclusion rule that becomes active when all conditions defined in it are satisfied.

Some examples or restriction rules:

  • 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.

Getting Started ↑ Back to top

The extension includes two types of Restrictions that you can use to conditionally activate payment and shipping options:

  • Product-level Restrictions
  • Global Restrictions

The objective of this chapter is to give you a good understanding of what Restrictions do and how you can use them to control your payment and shipping options.

Product-level Restrictions ↑ Back to top

As their name suggests, product-level restrictions are exclusion rules associated with specific products. Product-level restrictions are evaluated only if the product associated with the restriction is present in the cart during checkout. Product-level restrictions can be created from the Product Data section located in the edit-product screen:

Example of a Product-based Restriction
Example of a Product-based Restriction

This example shows you how to create a single Shipping Countries & States restriction for a simple product – Rechargeable Lithium Battery. The restriction prevents customers from selecting the United States as a shipping destination for this product, unless the order total is higher than $100.

Note that you can create product-level restrictions for:

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

Additionally, you can create multiple rules for the same restriction class — for example, it is possible to create multiple Payment Gateway restrictions for different payment gateways, or multiple restrictions (with different conditions) that target the same payment gateway.

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

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:

Global restrictions accessed under Settings > Restrictions.
Global restrictions accessed under Settings > Restrictions.

There, you will find 3 sections dedicated to creating and modifying global restrictions for:

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

Here’s an example of a very simple global restriction:

A simple Global Restriction.
A simple Global Restriction.

This Payment Gateway restriction disables the Direct Bank Transfer option for all orders with a value lower than $1000.

Note that, just like with product-level restrictions, you can create multiple rules for the same restriction class.

Conditions ↑ Back to top

As we have seen so far, every restriction can be accompanied by some conditions, which determine when the restriction gets into effect.

Conditions are very straightforward when looked at individually – however, to use them successfully, you must remember that a restriction rule will be in effect only if all defined conditions match at the same time.

To outline this concept better, let’s look at an example similar to the Rechargeable Lithium Battery product-based restriction that we saw earlier – only a bit more complex:

This time, we’re creating a global restriction to exclude all available shipping methods when customers:

  • choose the United States as the shipping destination of their order,
  • the order contains any product from the Batteries category and
  • its total is under $100.
A restriction with multiple conditions.
A restriction with multiple conditions.

The restriction will work only when all 3 conditions match simultaneously: If any of them is not satisfied, all shipping methods will be available as usual.

Working with multiple conditions - checkout notice.
Working with multiple conditions – checkout notice.

Restrictions Reference ↑ Back to top

Payment Gateways ↑ Back to top

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

Creating Global Rules

You can create global restriction rules for payment gateways by navigating to WooCommerce > Settings > Restrictions > Payment Gateways.

To add a new rule, click on the Add Global Restriction button. Then go on to configure its parameters:

  1. Enter a Short Description to identify this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Select one or more Payment Gateways that you want to conditionally disable with this new rule.
  3. Configure the Show Excluded setting. By default, excluded payment gateways are removed from the list of gateways available during checkout. Select this option if you prefer to show excluded gateways in the checkout options, and have a notice displayed when customers attempt to complete an order using an excluded payment option.
  4. Define exclusion conditions – the restriction will work if all defined conditions are satisfied simultaneously. If you don’t use any conditions, the gateways targeted by the rule will always be excluded/disabled.
Condition Description
Order Total In effect if the checkout order total is lower (<) or greater (>=) than this value.
Billing Countries In effect if the billing country selected during checkout is (or is not) included in this list.
Shipping Countries In effect if the shipping country selected during checkout is (or is not) included here. You can also target specific states/regions (see below).
Shipping States / Regions Part of the Shipping Countries condition – see above. Note that in order to select specific States, you first need to select some Shipping Countries with States/Regions, then save your changes and finally return to choose specific States/Regions.
Shipping Methods In effect if the shipping method selected during checkout is (or is not) included here.
Product Categories In effect if the cart contains (or does not contain) products from the categories included here.
Product Shipping Classes In effect if the cart contains (or does not contain) products from the shipping classes included here.
Items in package In effect if the quantity of items in the package is lower (<) or greater (>=) than this value.
Customer In effect if the current customer’s e-mail is (or is not) found in the e-mails included here.
Customer Role In effect if the current customer’s role is (or is not) found in the specified list of roles.
Coupon Code In effect if a coupon applied in the cart is (or is not) included in this list.

Creating Product-level Rules

Use product-level restriction rules for payment gateways if you want to exclude/disable one or more payment gateways when a specific product is in the cart. Product-level restrictions can be added from the Product Data > Restrictions tab located in every edit-product screen.

To add a new rule, select the Payment Gateways restriction and click on the Add Restriction button. Then go on to configure its parameters. The Short Description, Payment Gateways, and Show Excluded options are identical with their Global restriction equivalents. However, the available Conditions are slightly different:

  1. The Product Categories and Product Shipping Classses conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new condition, Product Quantity:
Condition Description
Product Quantity In effect if the cart item quantity of the product involved is lower (<) or 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+.

Creating Global Rules

You can create global restriction rules for shipping methods by navigating to WooCommerce > Settings > Restrictions > Shipping Methods.

To add a new rule, click on the Add Global Restriction button. Then go on to configure its parameters:

  1. Enter a Short Description to identify this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Select one or more Shipping Methods that you want to conditionally exclude/disable with this new rule.
  3. Configure the Show Excluded setting. By default, excluded shipping methods are removed from the list of options available during checkout. Check this box if you prefer to show excluded payment methods in the checkout options, and have a notice displayed when customers attempt to complete an order using an excluded shipping method.
  4. Define exclusion conditions – the restriction will work if all defined conditions are satisfied simultaneously. If you don’t use any conditions, the shipping methods targeted by the rule will always be excluded/disabled. Remember that most shipping method conditions operate at package-level, for compatibility with extensions that create multiple shipment packages from a single cart.
Condition Description
Cart Total In effect if the cart total (after discounts, including taxes) is lower (<) or greater (>=) than this value.
Billing Countries In effect if the billing country selected during checkout is (or is not) included in this list.
Shipping Countries In effect if the shipping country selected during checkout is (or is not) included here. You can also target specific states/regions (see below).
Shipping States / Regions Part of the Shipping Countries condition – see above. When specifying specifing states/regions, the condition is satisfied if the state/region selected at checkout is (or is not) included in the list.
Shipping Postcode In effect if the package’s destination postcode is (or is not) matched to the value or range of values specified here.
Product Categories In effect if the package contains (or does not contain) products from the categories included here.
Product Shipping Classes In effect if the package contains (or does not contain) products from the shipping classes included here.
Package Weight In effect if the total package weight is lower (<) or greater (>=) than this value.
Items in package In effect if the quantity of items in the package is lower (<) or greater (>=) than this value.
Package Total In effect if the checkout package total is lower (<) or greater (>=) than this value.
Customer In effect if the current customer’s e-mail is (or is not) found in the e-mails included here.
Customer Role In effect if the current customer’s role is (or is not) found in the specified list of roles.
Coupon Code In effect if a coupon applied in the cart is (or is not) included in this list.

Creating Product-level Rules

Use product-level restriction rules for shipping methods if you want to exclude/disable one or more shipping methods when a specific product is in the cart. Product-level restrictions can be added from the Product Data > Restrictions tab located in every edit-product screen.

To add a new rule, select the Shipping Methods restriction and click on the Add Restriction button. Then go on to configure its parameters. The Short Description, Shipping Methods, and Show Excluded options are identical with their Global restriction equivalents. However, the available Conditions are slightly different:

  1. The Product Categories and Product Shipping Classes conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new condition, Product Quantity:
Condition Description
Product Quantity In effect if the cart item quantity of the product involved is lower (<) or 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.

Creating Global Rules

You can create global restriction rules for shipping countries & states by navigating to WooCommerce > Settings > Restrictions > Shipping Countries & States.

To add a new rule, click on the Add Global Restriction button. Then go on to configure its parameters:

  1. Enter a Short Description to identify this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  2. Select one or more Shipping Countries that you want to conditionally disable with this new rule. If you need to disable specific Shipping States / Regions from one or more countries, you still need to add these countries here select specific pick states / regions in the next step.
  3. If you need to disable specific states or regions in the countries you added in the previous step, select the Specific States / Regions option from the Exclude States / Regions dropdown. Then select the states or regions that you want to disable.
  4. Optionally set a Custom Checkout Notice to be displayed when this rule is in effect. The default checkout notice should be sufficient in most cases – it is recommended to test what your customers will see when this rule is triggered and change the notice text only if necessary.
  5. Define exclusion conditions – the restriction will work when all defined conditions are satisfied simultaneously. If you don’t use any conditions, the countries/states targeted by the rule will always be restricted.
Condition Description
Cart Total In effect if the cart total (after discounts, including taxes) is lower (<) or greater (>=) than this value.
Product Categories In effect if the cart contains (or does not contain any) products from the categories included here. Also in effect if every cart item (or not every cart item) belongs to the categories included here.
Product Shipping Classes In effect if the cart contains (or does not contain any) products from the shipping classes included here. Also in effect if every cart item (or not every cart item) has a Shipping Class which is included here.
Items in package In effect if the quantity of items in the package is lower (<) or greater (>=) than this value.
Package Total In effect if the checkout package total is lower (<) or greater (>=) than this value.
Customer In effect if the current customer’s e-mail is (or is not) found in the e-mails included here.
Customer Role In effect if the current customer’s role is (or is not) found in the specified list of roles.

Creating Product-level Rules

Use product-level restriction rules for shipping countries & states if you want to prevent customers from using or more shipping country or state options when a specific product is in the cart. Product-level restrictions can be added from the Product Data > Restrictions tab located in every edit-product screen.

To add a new rule, select the Shipping Countries & States restriction and click on the Add Restriction button. Then go on to configure its parameters. The Short Description, Shipping Countries, and Exclude States / Regions options are identical with their Global restriction equivalents. However, the available Conditions are slightly different:

  1. The Product Categories and Product Shipping Classses conditions are unavailable, since product-level rules are linked to a specific product.
  2. There is a new condition, Product Quantity:
Condition Description
Product Quantity In effect if the cart item quantity of the product involved is lower (<) or 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. For this example, we will create multiple Flat-Rate shipping method instances in 2 Shipping Zones and enable them conditionally, depending on the order weight.

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).

For simplicity, the Shipping setup of this Example is based on 2 Shipping Zones:

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

Our 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

Following the WooCommerce Shipping Zones documentation, start by creating the 2 Zones, and then proceed by adding 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.

Next, create the necessary Shipping Method restrictions by navigating to Settings > Restrictions > Shipping Methods.

This is an overview of the required restriction rules, 3 in total:

Example 1 – Restriction rules overview.
Example 1 – Restriction rules overview.

Rule #1 – 5kg weight limit:

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

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

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

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

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

Example 2. Shipping Carrier TOS Compliance ↑ Back to top

Working with a Shipping Carrier often requires you to adhere to specific Terms of Service for shipping various types of products, such as dangerous goods. Depending on the shipping destination, shipping method and package contents, a carrier may refuse to handle your shipment, or may have specific pricing, packaging, handling or forwarding requirements.

Here, we are going to look an example we briefly touched upon at the beginning of this guide:

Exclude the Royal Mail method if a package contains products from the Batteries category:

Example 2 – Exclude Royal Mail when shipping Batteries.
Example 2 – Exclude Royal Mail 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 ideal in such cases, as they allow you to create custom notices that you can use to communicate with your customers.

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 TOS Compliance ↑ Back to top

Depending on what you are selling and how, compliance with the terms and conditions of your payment gateways may require some attention on your part. For instance, most payment gateways provide a list of items that you are not allowed to sell through them, or may have specific shipping requirements. In some cases, sellers might be required to use only shipping carriers that provide proof of the exact shipment date and destination, such as a trackable shipment ID.

The extension allows you to define Payment Gateway restrictions based on many conditions, including the selected shipping method(s). In the following example, a Payment Gateway rule is created to exclude PayPal when selecting the Unregistered Postal Delivery shipping method:

Example 4 – Exclude PayPal when shipping via unregistered Snail Mail.
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?

Let’s say you want to disable the FedEx Ground shipping method if, for example, perishable products have been added to the cart and they need to be shipped faster. You can exclude FedEx Ground by specifying it in the Shipping Rate ID field.

In some cases, you can find the exact spelling in the Shipping Method settings:

screen-shot-2016-10-27-at-10-01-16-am

You will also need to use placeholder “fedex:” which should precede the name of the shipping method as follows:

fedex:FEDEX_GROUND

As a result, the restriction should look as follows:

screen-shot-2016-10-27-at-10-03-21-am

If this doesn’t help, you may need to search for the ID of the exact rate you want to exlude using your browser inspector:

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