Shipping and Payments

Installation

  1. Download the optimizeform core .zip file from your Optimizeform account.
  2. Go toWordPress Admin > Plugins > Add New and Upload Plugin with the file you downloaded with Choose File.
  3. Install Now and Activate the extension.

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.

How it Works

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

The extension lets you create two types of Restrictions:

  • Global Restrictions
  • Product-level Restrictions

Global Restrictions

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 OptimizeForm > 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

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

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

Payment Gateways

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

Global Restrictions

To create a global Payment Gateway restriction:

  1. Navigate to OptimizeForm> 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 attempt to place an order using an excluded Payment Gateway.
  4. Custom Notice — Custom notice displayed to customers when attempt to place an order using an excluded Payment Gateway. Overrides the default notice.
  5. Show Static Notices — By default, when Show Excluded is enabled, a notice is displayed when customers attempt to place an order using a restricted Payment Gateway. Select this option if you also want to display a static notice under each restricted Payment Gateway.

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:

CONDITIONMODIFIERDESCRIPTION
Backorderin cartSatisfied if the cart contains at least one product on backorder.
not in cartSatisfied if the cart does not contain any product on backorder.
all cart itemsSatisfied if the cart contains only products on backorder.
not all cart itemsSatisfied if the cart contains at least one product that is not on backorder.
Billing CountryisSatisfied if one of the listed billing countries is selected at checkout.
is notSatisfied if none of the listed billing countries is selected at checkout.
Categoryin cartSatisfied if the cart contains at least one product from a listed category.
not in cartSatisfied if the cart does not contain any product from a listed category.
all cart itemsSatisfied if the cart contains only products from the listed categories.
not all cart itemsSatisfied if the cart contains at least one product that does not belong in any of the listed categories.
Coupon CodeusedSatisfied if a listed coupon is applied in the cart.
not usedSatisfied if none of the listed coupons is applied in the cart.
Customere-mail isSatisfied if the list of e-mails includes the current customer’s e-mail.
e-mail is notSatisfied if the list of e-mails does not include the current customer’s e-mail.
Customer RoleisSatisfied if the listed roles include the current customer’s role.
is notSatisfied if the listed roles do not include the current customer’s role.
Order Total<Satisfied if the checkout order total is lower (<) than this value.
>=Satisfied if the checkout order total is greater (>=) than this value.
Package Item Count<Satisfied if the quantity of items in a package is lower (<) than this value.
>=Satisfied if the quantity of items in a package is greater (>=) than this value.
Shipping Classin cartSatisfied if the cart contains at least one product from a listed shipping class.
not in cartSatisfied if the cart does not contain any product from a listed shipping class.
all cart itemsSatisfied if the cart contains only products from the listed shipping classes.
not all cart itemsSatisfied if the cart contains at least one product that does not belong in any of the listed shipping classes.
Shipping CountryisSatisfied 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 notSatisfied 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 MethodisSatisfied if one of the listed shipping methods is selected at checkout.
is notSatisfied if none of the listed shipping methods is selected at checkout.
Shipping PostcodeisSatisfied if the shipping postcode entered at checkout is equal to the specified value, or included in the specified range.
is notSatisfied if the shipping postcode entered at checkout is not equal to the specified value, or not included in the specified range.
Membership Plan 1active existsSatisfied if the current customer is a member of one of the listed Membership Plans.
all inactiveSatisfied if the current customer is not a member of any of the listed Membership Plans.
inactive existsSatisfied if the current customer is not a member of at least one of the listed Membership Plans.
all activeSatisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2in cartSatisfied if the cart contains at least one subscription product with the specified billing period.
not in cartSatisfied if the cart does not contain any subscription product with the specified billing period.
all in cartSatisfied if the cart contains only subscription products with the specified billing period.
not all in cartSatisfied if the cart contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Currency 3isSatisfied if one of the listed currencies is currently active.
is notSatisfied 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.
CONDITIONMODIFIERDESCRIPTION
Product Quantity<Satisfied if the cart item quantity of the product is lower (<) than this value.
>=Satisfied if the cart item quantity of the product is higher (>=) than this value.

Shipping Methods

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 OptimizeForm> 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.
  6. Show Static Notices — By default, when Show Excluded is enabled, a notice is displayed when customers attempt to place an order using a restricted Shipping Method. Select this option if you also want to display a static notice under each restricted Shipping Method.

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:

CONDITIONMODIFIERDESCRIPTION
Backorderin packageSatisfied if the package contains at least one product on backorder.
not in packageSatisfied if the package does not contain any product on backorder.
all package itemsSatisfied if the package contains only products on backorder.
not all package itemsSatisfied if the package contains at least one product that is not on backorder.
Billing CountryisSatisfied if one of the listed billing countries is selected at checkout.
is notSatisfied if none of the listed billing countries is selected at checkout.
Cart Total<Satisfied if the cart total (after discounts, including taxes) is lower (<) than this value.
>=Satisfied if the cart total (after discounts, including taxes) is greater (>=) than this value.
Categoryin packageSatisfied if the package contains at least one product from a listed category.
not in packageSatisfied if the package does not contain any product from a listed category.
all package itemsSatisfied if the package contains only products from the listed categories.
not all package itemsSatisfied if the package contains at least one product that does not belong in any of the listed categories.
Coupon CodeusedSatisfied if a listed coupon is applied in the cart.
not usedSatisfied if none of the listed coupons is applied in the cart.
Customere-mail isSatisfied if the list of e-mails includes the current customer’s e-mail.
e-mail is notSatisfied if the list of e-mails does not include the current customer’s e-mail.
Customer RoleisSatisfied if the listed roles include the current customer’s role.
is notSatisfied if the listed roles do not include the current customer’s role.
Package Item Count<Satisfied if the quantity of items in the package is lower (<) than this value.
>=Satisfied if the quantity of items in the package is greater (>=) than this value.
Package Total<Satisfied if the package total is lower (<) than this value.
>=Satisfied if the package total is greater (>=) than this value.
Package Weight<Satisfied if the total package weight is lower (<) than this value.
>=Satisfied if the total package weight is greater (>=) than this value.
Shipping Classin packageSatisfied if the package contains at least one product from a listed shipping class.
not in packageSatisfied if the package does not contain any product from a listed shipping class.
all package itemsSatisfied if the package contains only products from the listed shipping classes.
not all package itemsSatisfied if the package contains at least one product that does not belong in any of the listed shipping classes.
Shipping CountryisSatisfied 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 notSatisfied 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 PostcodeisSatisfied if the shipping postcode of the package is equal to the specified value, or included in the specified range.
is notSatisfied if the shipping postcode of the package is not equal to the specified value, or not included in the specified range.
Membership Plan 1active existsSatisfied if the current customer is a member of one of the listed Membership Plans.
all inactiveSatisfied if the current customer is not a member of any of the listed Membership Plans.
inactive existsSatisfied if the current customer is not a member of at least one of the listed Membership Plans.
all activeSatisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2in packageSatisfied if the package contains at least one subscription product with the specified billing period.
not in packageSatisfied if the package does not contain any subscription product with the specified billing period.
all in packageSatisfied if the package contains only subscription products with the specified billing period.
not all in packageSatisfied if the package contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Recurring Package 2isSatisfied if the package being evaluated is the recurring package of an initial subscription purchase, or a subscription renewal, with the specified billing schedule.
is notSatisfied if the package being evaluated is for an initial subscription order. Also satisfied for recurring packages and subscription renewals with a billing period other than the specified one.
all in packageSatisfied if the package contains only subscription products.
not all in packageSatisfied if the package contains at least one non-subscription product.
Currency 3isSatisfied if one of the listed currencies is currently active.
is notSatisfied 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.
CONDITIONMODIFIERDESCRIPTION
Product Quantity<Satisfied if the cart item quantity of the product is lower (<) than this value.
>=Satisfied if the cart item quantity of the product is higher (>=) than this value.

Shipping Countries & States

Shipping Country/State restrictions allow you to conditionally prevent customers from checking 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:

CONDITIONMODIFIERDESCRIPTION
Backorderin packageSatisfied if a package contains at least one product on backorder.
not in packageSatisfied if a package does not contain any product on backorder.
all package itemsSatisfied if a package contains only products on backorder.
not all package itemsSatisfied if a package contains at least one product that is not on backorder.
Cart Total<Satisfied if the cart total (after discounts, including taxes) is lower (<) than this value.
>=Satisfied if the cart total (after discounts, including taxes) is greater (>=) than this value.
Categoryin packageSatisfied if a package contains at least one product from a listed category.
not in packageSatisfied if a package does not contain any product from a listed category.
all package itemsSatisfied if a package contains only products from the listed categories.
not all package itemsSatisfied if a package contains at least one product that does not belong in any of the listed categories.
Customere-mail isSatisfied if the list of e-mails includes the current customer’s e-mail.
e-mail is notSatisfied if the list of e-mails does not include the current customer’s e-mail.
Customer RoleisSatisfied if the listed roles include the current customer’s role.
is notSatisfied if the listed roles do not include the current customer’s role.
Package Item Count<Satisfied if the quantity of items in a package is lower (<) than this value.
>=Satisfied if the quantity of items in a package is greater (>=) than this value.
Package Total<Satisfied if a package total is lower (<) than this value.
>=Satisfied if a package total is greater (>=) than this value.
Shipping Classin packageSatisfied if a package contains at least one product from the shipping classes included here.
not in packageSatisfied if a package contains does not contain any product from the shipping classes included here.
all package itemsSatisfied if a package contains only products from the shipping classes included here.
not all package itemsSatisfied if a package contains at least one product not from the shipping classes included here.
Membership Plan 1active existsSatisfied if the current customer is a member of one of the listed Membership Plans.
all inactiveSatisfied if the current customer is not a member of any of the listed Membership Plans.
inactive existsSatisfied if the current customer is not a member of at least one of the listed Membership Plans.
all activeSatisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2in packageSatisfied if the package contains at least one subscription product with the specified billing period.
not in packageSatisfied if the package does not contain any subscription product with the specified billing period.
all in packageSatisfied if the package contains only subscription products with the specified billing period.
not all in packageSatisfied if the package contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Currency 3isSatisfied if one of the listed currencies is currently active.
is notSatisfied 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.
CONDITIONMODIFIERDESCRIPTION
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

1. Conditional Flat Rates

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 NAMEDESTINATIONS
Zone AContinental US States only.
Zone BCanada, Mexico and non-continental US States.

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

RATE NAMEZONEWEIGHTRATE

Zone A StandardZone ALess than 2 kg.

$7
Zone A HeavyZone AMore than 2 kg but no higher than 5 kg.$14
Zone B StandardZone BLess than 2 kg.$10
Zone B HeavyZone BBetween 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

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

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

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

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

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

Welcome to the AovUp blog, where we discuss all things WooCommerce. I hope we can help you achieve something today...

Leave a Reply

Your email address will not be published. Required fields are marked *

We – and our partners – use cookies to deliver our services and to show you ads. By using our website, you agree to the use of cookies as described in our Cookie Policy