Conditional Shipping and Payments

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.
  6. Activate the plugin.

Requirements

↑ Back to top

Since version 2.0.0, the extension requires:

  • PHP 7.4+
  • WordPress 6.2+
  • WooCommerce 8.2+.

Getting Started

↑ Back to top

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

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

Conditional Shipping and Payments allows you to create rules to disable these options when certain conditions are met. It is possible to create both store-wide rules, as well as rules associated with specific products.

Moreover, you can set up and display helpful notices when customers attempt to use a restricted option, in order to:

  • advise them on how to proceed, or to
  • communicate a helpful message in your own voice.

Just getting started with WooCommerce? Check out the Shipping archive to learn more about setting up Shipping Zones and Shipping Methods. To start accepting payments, use one of the Core Payment Options or choose a premium payment gateway.

Here are some examples of what’s possible with Conditional Shipping and Payments:

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

In this guide you will find a handy reference of all conditions available for creating payment/shipping option restrictions.

Conditional Shipping and Payments does not create new shipping methods. You can use it to conditionally exclude existing shipping 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 email, and more.

Conditional Shipping and Payments is compatible with the new Cart and Checkout Blocks.

Creating Restrictions

↑ Back to top

The plugin supports two types of payment/shipping restrictions:

  • Global, store-wide restrictions.
  • Product-level restrictions.

Every restriction is accompanied by one or more conditions. A restriction is activated when all defined conditions are satisfied.

Global Restrictions

Global restrictions are always evaluated during checkout. To create and manage global restrictions navigate to WooCommerce > Settings > Restrictions.

Restrictions tab found at WooCommerce > Settings > Restrictions.

There are 4 sections dedicated to creating and managing restrictions:

  • Overview
  • Payment Gateways
  • Shipping Methods
  • Shipping Destinations

To create a global restriction:

  1. Navigate to WooCommerce > Settings > Restrictions.
  2. Navigate to the Payment Gateways, Shipping Methods, or Shipping Destinations section, depending on the type of restriction you want to create.
  3. Click the Add Restriction button.
  4. Configure options.

Here’s a Payment Gateway restriction that hides the Direct Bank Transfer option if the order total is lower than $1000:

A global Payment Gateway restriction example.

Note that you can add multiple rules to disable the same payment/shipping option. When using conditions, you can use multiple rules to create logical “or” expressions. In the previous example, a second rule has been added to hide the Direct Bank Transfer option if:

  • the order total is lower than $1000; or
  • a product on backorder has been added to the cart.

Product-level Restrictions

Product-level restrictions can be created in the Product Data > Restrictions tab of individual products. They are only evaluated for products contained in the cart.

To add a new product-level restriction:

  1. Navigate to Product Data > Restrictions.
  2. Choose the restriction type in the Choose restriction... drop-down.
  3. Click the Add button.
  4. Configure options.

Here’s a restriction that prevents customers from choosing the United States as a shipping destination for this particular product, if the cart total is lower than or equal to $50:

Restriction type menu for product-level restrictions.

As with global restrictions, you can:

  • set up product-level restrictions for Payment Gateways, Shipping Methods, and Shipping Destinations, and
  • create multiple rules for the same restriction type.

Configuring Restrictions

↑ Back to top

Payment Gateways

↑ Back to top

Payment Gateway restrictions allow you to conditionally hide certain payment gateways, or display a notice when customers attempt to use them.

Basic Options

Adding a Payment Gateway restriction reveals the following options:

  • Short Description — Identifies this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  • Exclude Gateways — The Payment Gateways you wish to disable by this new rule.
  • 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.
  • Custom Notice — Custom notice displayed to customers when they attempt to place an order using an excluded Payment Gateway. Overrides the default notice.
  • 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.

In the Order > Pay page, excluded Payment Gateways are always hidden. It is not possible to display excluded Payment Gateways in this page by enabling the Show Excluded option.

Show Static Notices is only supported by the shortcode-based Checkout. The option will be unavailable if your Checkout page is powered by the new WooCommerce Checkout Block.

Global Conditions

The following table lists all Conditions available in global Payment Gateway restrictions:

Condition Modifier Description
Backorder in cart Satisfied if the cart contains at least one product on backorder.
not in cart Satisfied if the cart does not contain any product on backorder.
all cart items Satisfied if the cart contains only products on backorder.
not all cart items Satisfied if the cart contains at least one product that is not on backorder.
Billing Country/State is Satisfied if the billing country chosen on the checkout page is included in the listed countries/continents. If states/regions are specified, the condition will match only if a listed state/region is selected on the checkout page, as well.
is not Satisfied if the billing country chosen on the checkout page is not included in the listed countries/continents. If one of the listed shipping countries is selected on the checkout page and states/regions are specified, the condition will match only if a non-listed state/region is selected.
Billing Postcode is Satisfied if the billing postcode entered in the checkout form matches the specified value, or is included in the specified range.
is not Satisfied if the billing postcode entered in the checkout form does not match the specified value, or is not included in the specified range.
Cart Item Count < Satisfied if the quantity of items in the cart is lower (<) than this value.
<= Satisfied if the quantity of items in the cart is lower than or equal to (<=) this value.
= Satisfied if the quantity of items in the cart is equal to this value.
> Satisfied if the quantity of items in the cart is greater (>) than this value.
>= Satisfied if the quantity of items in the cart is greater than or equal to (>=) this value.
Category in cart Satisfied if the cart contains at least one product from a listed category.
not in cart Satisfied if the cart does not contain any product from a listed category.
all cart items Satisfied if the cart contains only products from the listed categories.
not all cart items Satisfied if the cart contains at least one product that does not belong in any of the listed categories.
Coupon Code used Satisfied if a listed coupon is applied in the cart.
not used Satisfied if none of the listed coupons is applied in the cart.
enables free shipping Satisfied if a coupon that enables free shipping is applied in the cart.
does not enable free shipping Satisfied if no coupon that enables free shipping is applied in the cart.
Customer e-mail is Satisfied if the list of e-mails includes the current customer’s e-mail. Supports wildcards.
e-mail is not Satisfied if the list of e-mails/domains does not include the current customer’s e-mail. Supports wildcards.
is returning Satisfied if the customer has placed at least one order in the past.
is new Satisfied if the customer has never placed an order before.
Customer Role is Satisfied if the listed roles include the current customer’s role.
is not Satisfied if the listed roles do not include the current customer’s role.
Date/Time year is Satisfied if the year matches any of the listed years.
year is not Satisfied if the year does not match any of the listed years.
month is Satisfied if the month matches any of the listed months.
month is not Satisfied if the month does not match any of the listed months
day in month is Satisfied if the day in month matches any of the listed days.
day in months is not Satisfied if the day in month does not match any of the listed days.
day in week is Satisfied if the day in week matches any of the listed days.
day in week is not Satisfied if the day in month does not match any of the listed days.
hour is Satisfied if the hour matches any of the listed hours.
hour is not Satisfied if the hour does not match any of the listed hours.
Order Status in Satisfied if the order status matches one of the listed order statuses.
not in Satisfied if the order status does not match one of the listed order statuses.
Order Total < Satisfied if the checkout order total is lower (<) than this value.
<= Satisfied if the checkout order total is lower than or equal to (<=) this value.
> Satisfied if the checkout order total is greater than (>) this value.
>= Satisfied if the checkout order total is greater than or equal to (>=) this value.
Package Item Count < Satisfied if the quantity of items in the shipping package is lower (<) than this value.
<= Satisfied if the quantity of items in the shipping package is lower than or equal to (<) this value.
> Satisfied if the quantity of items in a package is greater (>) than this value.
>= Satisfied if the quantity of items in a package is greater than or equal to (>=) this value.
= Satisfied if the quantity of items in a package is equal to (=) this value.
Product On Sale in cart Satisfied if the cart contains at least one product on sale.
not in cart Satisfied if the cart does not contain any product on sale.
all cart items Satisfied if the cart contains only products on sale.
not all cart items Satisfied if the cart contains at least one product that is not on sale.
Shipping Class in cart Satisfied if the cart contains at least one product from a listed shipping class.
not in cart Satisfied if the cart does not contain any product from a listed shipping class.
all cart items Satisfied if the cart contains only products from the listed shipping classes.
not all cart items Satisfied if the cart contains at least one product that does not belong in any of the listed shipping classes.
Shipping Country/State is Satisfied if the shipping country chosen on the checkout page is included in the listed countries/continents. If states/regions are specified, the condition will match only if a listed state/region is selected on the checkout page, as well.
is not Satisfied if the shipping country chosen on the checkout page is not included in the listed countries/continents. If one of the listed shipping countries is selected on the checkout page and states/regions are specified, the condition will match only if a non-listed state/region is selected.
Shipping Method is Satisfied if one of the listed shipping methods is selected at checkout.
is not Satisfied if none of the listed shipping methods is selected at checkout.
Shipping Postcode is Satisfied if the shipping postcode entered in the checkout form matches the specified value, or included in the specified range.
is not Satisfied if the shipping postcode entered in the checkout form does not match the specified value, or is not included in the specified range.
Membership Plan 1 active exists Satisfied if the current customer is a member of one of the listed Membership Plans.
all inactive Satisfied if the current customer is not a member of any of the listed Membership Plans.
inactive exists Satisfied if the current customer is not a member of at least one of the listed Membership Plans.
all active Satisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2 in cart Satisfied if the cart contains at least one subscription product with the specified billing period.
not in cart Satisfied if the cart does not contain any subscription product with the specified billing period.
all in cart Satisfied if the cart contains only subscription products with the specified billing period.
not all in cart Satisfied if the cart contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Currency 3 is Satisfied if one of the listed currencies is currently active.
is not Satisfied if none of the listed currencies is currently active.
Gift Card Product 4 in cart Satisfied if the cart contains at least one gift card product.
not in cart Satisfied if the cart does not contain any gift card product.
all cart items Satisfied if the cart contains only gift card products.
not all cart items Satisfied if the cart contains at least one gift card product.
Gift Cards 4 used Satisfied if a gift card is applied in the cart.
not used Satisfied if no gift cards are applied in the cart.

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


Product-level Conditions

When configuring Payment Gateway restrictions for specific products, you will find that some of these Conditions are unavailable. However, there is an additional Item Quantity condition:

Condition Modifier Description
Item Quantity < Satisfied if the cart item quantity of this product is lower (<) than this value.
<= In effect if the cart item quantity of this product is lower than or equal to (<=) this value.
> In effect if the cart item quantity of this product is greater than (>) this value.
>= In effect if the cart item quantity of this product is greater than or equal to (>=) this value.

Shipping Methods

↑ Back to top

Shipping Method restrictions allow you to conditionally hide certain shipping methods, or display a notice when customers attempt to use them.

Basic Options

Adding a Shipping Method restriction reveals the following options:

  • Short Description — Identifies this rule. As you add more rules, short descriptions will make it easier for you to manage them effectively.
  • Exclude Methods — The Shipping Methods that you wish to disable by this new rule.
  • Exclude Rate IDs — Advanced option for excluding Shipping Method options generated by external APIs.
  • 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.
  • Custom Notice — Custom notice displayed to customers when choosing an excluded Shipping Method. Overrides the default notice.
  • 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.

Show Static Notices is only supported by the shortcode-based Checkout. The option will be unavailable if your Checkout page is powered by the new WooCommerce Checkout Block.

Global Conditions

The following table lists all Conditions available in global Shipping Method restrictions:

Carts vs Packages

Sometimes, the items purchased in an order may need to be split across multiple shipments. This may happen if you are using a plugin such as Shipping Multiple Addresses. In this case, WooCommerce may split the contents of a cart into multiple “shipping packages”, and prompt customers to choose a different shipping method for each package.

Shipping Method restrictions are designed to support these scenarios, which may help explain the use of the term “shipping package” in the table that follows. In most cases, the term “shipping package” can be used interchangeably with the term “cart”.

Condition Modifier Description
Backorder in package Satisfied if the package contains at least one product on backorder.
not in package Satisfied if the package does not contain any product on backorder.
all package items Satisfied if all the products in the package are on backorder.
not all package items Satisfied if the package contains at least one product that is not on backorder.
Billing Country/State is Satisfied if the billing country chosen on the checkout page is included in the listed countries/continents. If states/regions are specified, the condition will match only if a listed state/region is selected on the checkout page, as well.
is not Satisfied if the billing country chosen on the checkout page is not included in the listed countries/continents. If one of the listed shipping countries is selected on the checkout page and states/regions are specified, the condition will match only if a non-listed state/region is selected.
Billing Postcode is Satisfied if the billing postcode entered in the checkout form matches the specified value, or is included in the specified range.
is not Satisfied if the billing postcode entered in the checkout form does not match the specified value, or is not included in the specified range.
Cart Subtotal < Satisfied if the cart subtotal (cart total before discounts) is lower than (<) this value.
<= Satisfied if the cart subtotal (cart total before discounts) is lower than or equal to (<=) this value.
> Satisfied if the cart subtotal (cart total before discounts) is greater than (>) this value.
>= Satisfied if the cart subtotal (cart total before discounts) is greater than or equal to (>=) this value.
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 lower than or equal to (<=) this value.
> Satisfied if the cart total (after discounts, including taxes) is greater than (>) this value.
>= Satisfied if the cart total (after discounts, including taxes) is greater than or equal to (>=) this value.
Category in package Satisfied if the shipping package contains at least one product from a listed category.
not in package Satisfied if the shipping package does not contain any product from a listed category.
all package items Satisfied if the shipping package contains only products from the listed categories.
not all package items Satisfied if the shipping package contains at least one product that does not belong in any of the listed categories.
Coupon Code used Satisfied if a listed coupon is applied in the cart.
not used Satisfied if none of the listed coupons is applied in the cart.
enables free shipping Satisfied if a coupon that enables free shipping is applied in the cart.
does not enable free shipping Satisfied if no coupon that enables free shipping is applied in the cart.
Customer e-mail is Satisfied if the list of e-mails/domains includes the current customer’s e-mail. Supports wildcards.
e-mail is not Satisfied if the list of e-mails/domains does not include the current customer’s e-mail. Supports wildcards.
Customer Role is Satisfied if the listed roles include the current customer’s role.
is not Satisfied if the listed roles do not include the current customer’s role.
Date/Time year is Satisfied if the year matches any of the listed years.
year is not Satisfied if the year does not match any of the listed years.
month is Satisfied if the month matches any of the listed months.
month is not Satisfied if the month does not match any of the listed months
day in month is Satisfied if the day in month matches any of the listed days.
day in months is not Satisfied if the day in month does not match any of the listed days.
day in week is Satisfied if the day in week matches any of the listed days.
day in week is not Satisfied if the day in month does not match any of the listed days.
hour is Satisfied if the hour matches any of the listed hours.
hour is not Satisfied if the hour does not match any of the listed hours.
Package Item Count < Satisfied if the quantity of items in the shipping package is lower (<) than this value.
<= Satisfied if the quantity of items in the shipping package is lower than or equal to (<) this value.
> Satisfied if the quantity of items in a package is greater (>) than this value.
>= Satisfied if the quantity of items in a package is greater than or equal to (>=) this value.
= Satisfied if the quantity of items in a package is equal to (=) this value.
Package Total < Satisfied if the shipping package total is lower than (<) this value.
<= Satisfied if the shipping package total is lower than or equal to (<=) this value.
> Satisfied if the shipping package total is greater than (<) this value.
>= Satisfied if the shipping package total is greater than or equal to (>=) this value.
Package Weight < Satisfied if the total package weight is lower than (<) this value.
<= Satisfied if the weight of all products in the shipping package is lower than or equal to (<=) this value.
> Satisfied if the weight of all products in the shipping package is greater than (<) this value.
>= Satisfied if the weight of all products in the shipping package is greater or equal to (>=) this value.
Shipping Class in package Satisfied if the shipping package contains at least one product from a listed shipping class.
not in package Satisfied if the shipping package does not contain any product from a listed shipping class.
all package items Satisfied if the shipping package contains only products from the listed shipping classes.
not all package items Satisfied if the shipping package contains at least one product that does not belong in any of the listed shipping classes.
Shipping Country/State is Satisfied if the shipping country chosen on the checkout page is included in the listed countries/continents. If states/regions are specified, the condition will match only if a listed state/region is selected on the checkout page, as well.
is not Satisfied if the shipping country chosen on the checkout page is not included in the listed countries/continents. If one of the listed shipping countries is selected on the checkout page and states/regions are specified, the condition will match only if a non-listed state/region is selected.
Shipping Postcode is Satisfied if the shipping package postcode matches the specified value, or included in the specified range.
is not Satisfied if the shipping package postcode entered in the checkout form matches the specified value, or included in the specified range.
Membership Plan 1 active exists Satisfied if the current customer is a member of one of the listed Membership Plans.
all inactive Satisfied if the current customer is not a member of any of the listed Membership Plans.
inactive exists Satisfied if the current customer is not a member of at least one of the listed Membership Plans.
all active Satisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2 in package Satisfied if the shipping package contains at least one subscription product with the specified billing period.
not in package Satisfied if the shipping package does not contain any subscription product with the specified billing period.
all in package Satisfied if the shipping package contains only subscription products with the specified billing period.
not all in package Satisfied if the shipping package contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Recurring Package 2 is Satisfied if the package being evaluated is the recurring package of an initial subscription purchase, or a subscription renewal, with the specified billing schedule.
is not Satisfied 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.
Currency 3 is Satisfied if one of the listed currencies is currently active.
is not Satisfied if none of the listed currencies is currently active.

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


The Cart Subtotal condition value is evaluated as inclusive or exclusive tax, depending on how you have configured WooCommerce to display prices in the Cart and Checkout pages. 

Product-level Conditions

When configuring Shipping Method restrictions for specific products, you will find that some of these Conditions are unavailable. However, there is an additional Item Quantity condition:

Condition Modifier Description
Item Quantity < Satisfied if the quantity of this product in the shipping package is lower (<) than this value.
<= In effect if the quantity of this product in the shipping package is lower than or equal to (<=) this value.
> In effect if the quantity of this product in the shipping package is greater than (>) this value.
>= In effect if the quantity of this product in the shipping package is greater than or equal to (>=) this value.

Shipping Destinations

↑ Back to top

Shipping Destination restrictions allow you to conditionally prevent customers from shipping their order to specific countries or states.

Basic Options

Adding a Shipping Destination restriction reveals the following options:

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

Global Conditions

The following table lists all Conditions available in global Shipping Destination restrictions:

Condition Modifier Description
Backorder in package Satisfied if the package contains at least one product on backorder.
not in package Satisfied if the package does not contain any product on backorder.
all package items Satisfied if all the products in the package are on backorder.
not all package items Satisfied if the package contains at least one product that is not on backorder.
Cart Subtotal < Satisfied if the cart subtotal (cart total before discounts, including taxes) is lower than (<) this value.
<= Satisfied if the cart subtotal (cart total before discounts, including taxes) is lower than or equal to (<=) this value.
> Satisfied if the cart subtotal (cart total before discounts, including taxes) is greater than (>) this value.
>= Satisfied if the cart subtotal (cart total before discounts, including taxes) is greater than or equal to (>=) this value.
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 lower than or equal to (<=) this value.
> Satisfied if the cart total (after discounts, including taxes) is greater than (>) this value.
>= Satisfied if the cart total (after discounts, including taxes) is greater than or equal to (>=) this value.
Category in package Satisfied if the shipping package contains at least one product from a listed category.
not in package Satisfied if the shipping package does not contain any product from a listed category.
all package items Satisfied if the shipping package contains only products from the listed categories.
not all package items Satisfied if the shipping package contains at least one product that does not belong in any of the listed categories.
Coupon Code used Satisfied if a listed coupon is applied in the cart.
not used Satisfied if none of the listed coupons is applied in the cart.
enables free shipping Satisfied if a coupon that enables free shipping is applied in the cart.
does not enable free shipping Satisfied if no coupon that enables free shipping is applied in the cart.
Customer e-mail is Satisfied if the list of e-mails includes the current customer’s e-mail. Supports wildcards.
e-mail is not Satisfied if the list of e-mails does not include the current customer’s e-mail. Supports wildcards.
Customer Role is Satisfied if the listed roles include the current customer’s role.
is not Satisfied if the listed roles do not include the current customer’s role.
Date/Time year is Satisfied if the year matches any of the listed years.
year is not Satisfied if the year does not match any of the listed years.
month is Satisfied if the month matches any of the listed months.
month is not Satisfied if the month does not match any of the listed months
day in month is Satisfied if the day in month matches any of the listed days.
day in months is not Satisfied if the day in month does not match any of the listed days.
day in week is Satisfied if the day in week matches any of the listed days.
day in week is not Satisfied if the day in month does not match any of the listed days.
hour is Satisfied if the hour matches any of the listed hours.
hour is not Satisfied if the hour does not match any of the listed hours.
Package Item Count < Satisfied if the quantity of items in the shipping package is lower (<) than this value.
<= Satisfied if the quantity of items in the shipping package is lower than or equal to (<) this value.
> Satisfied if the quantity of items in a package is greater (>) than this value.
>= Satisfied if the quantity of items in a package is greater than or equal to (>=) this value.
Package Total < Satisfied if the shipping package total is lower than (<) this value.
<= Satisfied if the shipping package total is lower than or equal to (<=) this value.
> Satisfied if the shipping package total is greater than (<) this value.
>= Satisfied if the shipping package total is greater than or equal to (>=) this value.
Package Weight < Satisfied if the total package weight is lower than (<) this value.
<= Satisfied if the weight of all products in the shipping package is lower than or equal to (<=) this value.
> Satisfied if the weight of all products in the shipping package is greater than (<) this value.
>= Satisfied if the weight of all products in the shipping package is greater or equal to (>=) this value.
Shipping Class in package Satisfied if the shipping package contains at least one product from a listed shipping class.
not in package Satisfied if the shipping package does not contain any product from a listed shipping class.
all package items Satisfied if the shipping package contains only products from the listed shipping classes.
not all package items Satisfied if the shipping package contains at least one product that does not belong in any of the listed shipping classes.
Shipping Postcode is Satisfied if the shipping package postcode matches the specified value, or included in the specified range.
is not Satisfied if the shipping package postcode entered in the checkout form matches the specified value, or included in the specified range.
Membership Plan 1 active exists Satisfied if the current customer is a member of one of the listed Membership Plans.
all inactive Satisfied if the current customer is not a member of any of the listed Membership Plans.
inactive exists Satisfied if the current customer is not a member of at least one of the listed Membership Plans.
all active Satisfied if the current customer is a member of all listed Membership Plans.
Product on Subscription 2 in package Satisfied if the shipping package contains at least one subscription product with the specified billing period.
not in package Satisfied if the shipping package does not contain any subscription product with the specified billing period.
all in package Satisfied if the shipping package contains only subscription products with the specified billing period.
not all in package Satisfied if the shipping package contains at least one non-subscription product, or a subscription product with a billing period other than the specified one.
Recurring Package 2 is Satisfied if the package being evaluated is the recurring package of an initial subscription purchase, or a subscription renewal, with the specified billing schedule.
is not Satisfied 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.
Currency 3 is Satisfied if one of the listed currencies is currently active.
is not Satisfied if none of the listed currencies is currently active.

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


The Cart Subtotal condition value is evaluated as inclusive or exclusive tax, depending on how you have configured WooCommerce to display prices in the Cart and Checkout pages. 

Product-level Conditions

When configuring Shipping Destination restrictions for specific products, you will find that some of these Conditions are unavailable. However, there is an additional Item Quantity condition:

Condition Modifier Description
Item Quantity < Satisfied if the quantity of this product in the shipping package is lower (<) than this value.
<= In effect if the quantity of this product in the shipping package is lower than or equal to (<=) this value.
> In effect if the quantity of this product in the shipping package is greater than (>) this value.
>= In effect if the quantity of this product in the shipping package is greater than or equal to (>=) this value.

Restriction Notices

↑ Back to top

When creating Payment Gateway or Shipping Method restrictions, you have the option to:

  • leave Show Excluded disabled, and hide the restricted option(s); or
  • enable Show Excluded and display a notice to customers who want to use the restricted option(s).

When choosing to display a notice, it is vital to communicate the right message to your customers. Helpful notices provide a smooth customer experience and minimize cart abandonment.

Conditional Shipping and Payments supports 2 types of notices:

  1. Validation notices, which are shown to the customer when they attempt to place an order using a restricted option.
  2. Static notices, which are shown on the checkout form next to the restricted option(s).

Both types of notices can be customized to provide an accurate message to your customers, while maintaining your brand voice.

Custom Notices

When Show Excluded is enabled, the displayed validation notices are auto-generated:

Auto-generated validation notice.

The Custom Notice option allows you to convey a more customized message:

Custom validation notice.

Custom messages support placeholders such as {excluded_gateway} (replaced by the name of the excluded payment gateway) and {excluded_method} (replaced by the name of the excluded shipping rate).

Static Notices

Static Notices are only supported by the shortcode-based Checkout. The Show Static Notices option will be unavailable if your Checkout page is powered by the new WooCommerce Checkout Block.

Static notices can be enabled by checking the Show Static Notices box in the restriction options: 

Static notice added next to a restricted payment option.

Troubleshooting

↑ Back to top

To help you to identify and resolve (i) mistakes with conditional logic, or (ii) conflicts with other plugins, Conditional Shipping and Payments offers the following troubleshooting options:

Disable all global restrictions and Disable all product-level restrictions — Use these troubleshooting options whenever you need a quick way to disable all global/product restrictions you have set up.

Debug mode — Enable this option if you need help to identify the rule(s) responsible for excluding any shipping or payment option. When this option is enabled, a debug message appears on the checkout page. This message can be viewed by all customers on your store.

Debug Mode messages on the Checkout page.

To enable any of these troubleshooting tools:

  1. Navigate to WooCommerce > Settings > Restrictions.
  2. Locate the Troubleshooting section.
  3. Enable the troubleshooting option(s) you want.
  4. Save your changes.
Troubleshooting options found at WooCommerce > Settings > Restrictions > Overview.

Examples

↑ Back to top

1. Restrict Shipping Methods by Weight

↑ 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 options per zone, and make them conditionally available depending on the shipping package (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 hides Zone A Standard and Zone B Standard if the shipping package weight is greater than or equal to 2kg:

Rule #1.

Rule #2 hides Zone A Heavy and Zone B Heavy if the shipping package weight is lower than 2kg:

Rule #2.

Rule #3 hides all shipping options if the shipping package weight is higher than 5kg:

Rule #3.

2. Restrict Shipping Methods by Product Category

↑ Back to top

Courier companies require merchants to comply with specific policies for certain types of products, such 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, Zone A Standard and Zone B Standard are restricted when a shipping package contains products from the Batteries category:

Exclude shipping methods from multiple Zones when shipping Batteries.

3. Restrict Payment Gateways by Shipping Method

↑ 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 as some payment service providers may:

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

In the following example, a Payment Gateway restriction is created to prevent customers who choose the Unregistered Postal Delivery shipping method from paying with PayPal:

Exclude PayPal when shipping via Unregistered Postal Delivery.

Frequently Asked Questions

↑ Back to top

I am trying to exclude a specific live shipping rate supplied by a courier API. However, it is not available for selection when I create a restriction.

↑ Back to top

To calculate live shipping rates, some Shipping Methods may connect WooCommerce to an external API. 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 selection when creating Shipping Method restrictions.

As a workaround, you can search for and exclude these live shipping rates by ID. However, you will need to do some extra work to find the IDs associated with each shipping rate:

  1. Activate your browser’s Developer Tools/Console. If you are using Chrome press Shift+CTRL+J  (or Option+Cmd+J on OS X) to toggle the console. If you are using Firefox, press Ctrl+Shift+K (or Cmd+Option+K on OS X). If you are using Safari, press Option+Cmd+C on OS X.
  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:priority_air.
  4. Paste it into the Excluded Rate IDs field.

Can I use this extension to let customers use multiple payment methods per order?

↑ Back to top

No, WooCommerce does not support multiple payment methods per order.

What is the difference between Cart Total and Order Total?

↑ Back to top

The order total includes the shipping cost and tax, whereas the cart total only includes tax.

Is Package Total the same as Cart Total?

↑ Back to top

Yes, unless you are using a plugin that splits the cart into multiple shipping packages. 

I find it difficult to understand why a payment/shipping option on my site is hidden/excluded. Is there a way to identify the rule(s) responsible for this?

↑ Back to top

To identify the restriction rule(s) responsible for hiding/excluding any payment or shipping option:

  1. Log into your WordPress dashboard and navigate to WooCommerce > Settings > Restrictions > Overview > Troubleshooting.
  2. Enable the Debug Mode option.
  3. Go to the checkout page.
  4. Examine the messages rendered by the Debug Mode tool at the top of the page.

The information provided on the checkout page when Debug Mode is enabled helps you identify:

  • all shipping/payment options currently excluded by Conditional Shipping and Payments;
  • for each excluded shipping/payment option, the rule(s) currently in effect.
Debug Mode messages on the Checkout page.

For more details on how to activate Debug Mode please visit Troubleshooting.

Code Snippets

↑ Back to top

Note: We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet or extend its functionality, we recommend working with a Woo Agency Partner or finding a WooCommerce developer on Codeable.

How to create new conditions that include multiple modifiers

To create new conditions that include multiple modifiers (for example: Package Item count for specific category), use the following snippet:

<?php

add_filter( 'woocommerce_csp_conditions', function( $condition_classes ) {
class WC_CSP_Condition_Package_Item_Quantity_Bottles extends WC_CSP_Condition_Package_Item_Quantity {

    public function __construct() {
        parent::__construct();
        $this->id = 'bottles_in_package';
        $this->title = __( 'Bottles Count', 'woocommerce-conditional-shipping-and-payments' );
    }
  }

  $condition_classes[] = 'WC_CSP_Condition_Package_Item_Quantity_Bottles';
  
  return $condition_classes;
} );


add_filter( 'woocommerce_csp_package_item_quantity_count', 'wc_sw_csp_bottles_items_count', 10, 4 );
function wc_sw_csp_bottles_items_count( $total_quantity, $package, $data, $args ) {
  
  $total_quantity = 0;
  if ( 'shipping_methods' === $args[ 'restriction_data' ][ 'restriction_id' ] && 'bottles_in_package' === $data[ 'condition_id' ] ) {

    foreach ( $package[ 'contents' ] as $cart_item_key => $cart_item_data ) {
        $product_id = $cart_item_data[ 'product_id' ];
        $terms = get_the_terms( $product_id, 'product_cat' );
        $terms_slugs = array();
        foreach ( $terms as $term ) {
          $terms_slugs[] = $term->slug;
    }

    if ( in_array( 'wine', $terms_slugs ) ) {
      $total_quantity += $cart_item_data[ 'quantity' ];
}
    }
  }

  return $total_quantity;
}
View on Github

The above example snippet creates a custom Condition under the WooCommerce > Settings > Restrictions tab named Bottles count.

This condition will evaluate the total number of items added into the cart from a category named wine (which needs to be updated in the code example, on line 33, to match the slug of your product category).

Define a Cart Total, Cart Subtotal, Package Total, and Order Total condition value excluding tax

↑ Back to top

Yes. Use the following snippet:

View on Github

To use this snippet, download the linked file and activate it as you would with any other plugin. Alternatively, copy the contained copy the contained code into your child theme’s functions.php file, or activate it using this plugin.

Is it possible to display checkout validation notices before customers attempt to place their order?

↑ Back to top

Yes. Use the following snippet to change the default plugin behavior:

This snippet has no effect when using the new Checkout Block.

View on Github

To use this snippet, download the linked file and activate it as you would with any other plugin. Alternatively, copy the contained code into your child theme’s functions.php file, or activate it using this plugin.

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!

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.