WPRuby Blog

Explore our blog for expert tips on WordPress plugins, development, and eCommerce solutions to grow your online business.

WooCommerce Shipping and Payment Rules: The Complete Guide

Blog Image

Most stores outgrow WooCommerce’s default checkout. You want free shipping, but not to remote postcodes. You want cash on delivery, but not for a first order worth $2,000. Wholesale buyers need their own rates, and a heavy order shouldn’t be able to pick a letter service.

This guide explains how WooCommerce shipping and payment rules work: what WooCommerce does on its own, which rule types exist, and the two different jobs rules do. Then it walks through common recipes, with links to step-by-step guides where we have one.

What WooCommerce does on its own

WooCommerce has three tools for shipping, and they cover more than people expect:

  • Shipping zones. A zone is a list of continents, countries, states or postcodes. Each zone has its own shipping methods, so customers only see the methods for the zone their address falls in.
  • Shipping classes. Put bulky or fragile products in a class, and Flat rate can charge a different cost for each class. Flat rate costs can also use placeholders such as [qty], [cost] and [weight], plus a percentage [fee].
  • Free shipping. It can require a free shipping coupon, a minimum order amount, either one, or both.

Where it stops: you can’t hide a method because of the cart’s weight, the customer’s role, a product in the cart or the time of day. A free shipping minimum applies to everyone in the zone, so retail and wholesale can’t have different ones. And apart from a few gateway-specific settings, there’s no way to show a payment method only to some customers or carts. That’s where rules come in.

The rule types

A rule checks one thing about the checkout. Here are the rules in our two Pro plugins, grouped by what they look at. Names are as they appear in each plugin.

ChecksRestricted Shipping and Payment ProSimple Table Rates Pro
LocationShipping Country, Billing Country, State, City, PostcodeNone: the shipping zone sets the destination
CartCart Total, Package Weight, Total Cart Quantity, Coupon Code, Payment Gateway (shipping conditions), Shipping Method (payment conditions)Weight, Cart Total, Quantity, Volume, Total Dimensions, Coupon, Payment Method
CustomerCustomer (email), Customer Role, Logged In or Guest, Previous OrdersUser Role
ProductProduct, Product Category, Product Tag, Product Attribute, Shipping Class, Downloadable, VirtualProduct, Product Category, Product Tag, Product Attribute, Shipping Class, Product Stock Status
TimeTime of Day, Day of Week, DateTime, Day

A few details matter when you set them up in Restricted Shipping and Payment Pro:

  • Postcode takes a comma-separated list, wildcards (902*) and ranges (90000...90999), like shipping zones. City takes a list too.
  • Cart Total checks the cart subtotal: the products, before shipping and coupon discounts. Tax is included only if your store shows prices with tax.
  • Package Weight is entered in kg. The plugin converts your product weights to kg first.
  • Previous Orders counts processing and completed orders. Guests are matched by their billing email.
  • Customer checks one email address, and Customer Role checks one role. To cover several, add one rule for each in a group set to “Match any of these rules”. To tell guests from account holders, use Logged In or Guest.

The two jobs rules do

“Conditional shipping” can mean two different things. Some rules decide whether a method or gateway appears. Others decide what a rate costs. They need different tools.

Job 1: hide or restrict methods and gateways

Restricted Shipping and Payment Pro adds Shipping Conditions and Payment Conditions to the WooCommerce menu. A condition has three parts:

  1. What it controls: shipping methods (each method in each zone is listed separately) or payment gateways. Any WooCommerce gateway works.
  2. The action: “Hide them when the cart matches the rules”, or “Show them only when the cart matches the rules”.
  3. The rules, in one or more groups.

You can add a message for the customer, shown in the cart and checkout as a notice, success or error when the condition hides something. Each condition also has a priority, and you can stop lower-priority conditions from running once one hides something. For the step-by-step setup, see setting up shipping methods conditions and setting up payment gateways conditions. Our older post on hiding a payment gateway or shipping method based on rules also covers the code route.

Job 2: calculate the rate

Simple Table Rates Pro is a shipping method you add to a zone. You build a table: each row has a condition type, a range or value, and a cost. For example, Weight from 0 to 0.5 kg costs $5, and 0.51 to 1 kg costs $8.

Simple Table Rates Pro rules table with Weight rows and From and To ranges

The Calculation Method decides what happens when several rows match:

  • Sum: adds the costs of all matching rows.
  • Break on first match: uses the first matching row.
  • Cheapest or Most Expensive: uses the lowest or highest matching cost.

Each row checks one condition and has a fixed cost. To combine conditions, use Sum: a set of weight rows for the base price, plus a Shipping Class row that adds a surcharge. For per-kg pricing, use more weight bands. You can add a handling fee to the total, as an amount or a percentage.

Rows can also run actions: Cancel calculations (the method isn’t offered), Stop calculations, Show customer message, Rename shipping title, Add subtitle and Hide other methods. The rules and actions doc and the settings doc cover each one.

Simple Table Rates Pro actions: cancel or stop calculations, show a message, rename, add a subtitle, hide other methods

Table rates or restrictions?

If the price is right but the wrong options show, you need restrictions. If the options are right but the price is wrong, you need table rates. Many stores use both: Simple Table Rates Pro prices the order, and Restricted Shipping and Payment Pro hides what shouldn’t be offered. Payment rules are only in Restricted Shipping and Payment Pro. If you’re comparing table rate plugins, see the best free WooCommerce table rate shipping plugins.

Common recipes

Exclude remote postcodes from free shipping

In Restricted Shipping and Payment Pro, create a shipping condition for your Free shipping method with a Postcode rule listing the areas, using wildcards or ranges. Add a message so customers know why. Read how to hide shipping methods by postcode.

Different free shipping thresholds by state

WooCommerce can do this alone if each state has its own zone with its own minimum. If you’d rather keep one zone, hide Free shipping with a group like “State is Western Australia AND Cart Total less than 150”. Read how to set different free shipping thresholds by state.

Hide international shipping for heavy carts

Hide your international methods with a Package Weight more than 2 kg rule, and tell customers to contact you for a quote. Read how to hide international shipping for products over 2kg.

Wholesale shipping rates for logged-in customers

Add a wholesale shipping method and set its condition to “Show them only when the cart matches the rules”, with Customer Role is your wholesale role. To price it instead, add a User Role row in Simple Table Rates Pro. Read how to show wholesale shipping rates only to logged-in customers.

Disable cash on delivery for risky orders

Create a payment condition for Cash on delivery. Use Cart Total more than your limit, Postcode for areas you don’t serve, or Previous Orders less than 1 for first-time buyers, in a group set to match any. Read how to disable cash on delivery in WooCommerce.

Payment methods by role or shipping method

To offer bank transfer or invoice payment only to trade accounts, show the gateway only when Customer Role is your trade role (see Net 30 payment terms in WooCommerce). To allow cash on delivery only with local pickup, use the Shipping Method rule in a payment condition. If you build gateways with Custom Payment Gateway Pro, they have their own conditional display rules.

Same-day delivery only before the cut-off

Show your same-day method only when Time of Day is between opening time and 15:00, and add Day of Week to drop weekends. A Date rule handles holidays. Times use your site’s timezone. Read how to show same-day delivery only before 3 PM.

Weekend surcharge

In Simple Table Rates Pro with Sum, add two Day rows, Saturday and Sunday, each with the surcharge as its cost. They’re added to your normal rows for orders placed at the weekend. Read how to charge a weekend delivery surcharge.

Cheaper shipping with a coupon

Add a Coupon row with the lower price and set the calculation method to Cheapest. Or, in Restricted Shipping and Payment Pro, show a discounted method only when Coupon Code is included in the order. Read how to apply shipping discounts with specific coupons.

Handling fee for fragile products

With Sum, add a Product Tag or Shipping Class row whose cost is the fee. It’s added once when any fragile item is in the cart, as part of the table rate rather than a separate fee line. Read how to add a handling fee for fragile products.

Rename shipping based on the cart

Give a row the Rename shipping title or Add subtitle action, for example “Insured delivery” when a fragile tag matches. This changes Simple Table Rates Pro’s own rate, not other methods. Read how to rename shipping methods based on cart contents.

Bulky and volumetric items

Simple Table Rates Pro prices by Volume (the cart’s total volume) or Total Dimensions (each item’s length, width and height added together, for every item in the cart) in bands. It doesn’t apply a carrier’s volumetric weight formula, so set your bands to match what the carrier charges. Read how to charge volumetric shipping rates.

Rule groups: AND and OR

In Restricted Shipping and Payment Pro, rules sit in groups. Each group is set to “Match all of these rules” (AND) or “Match any of these rules” (OR). Groups are then joined with AND or OR.

Say you want to hide Free shipping for heavy carts going to the US, and for every cart with a coupon. Group 1 is “Shipping Country is United States AND Package Weight more than 20 kg”. Group 2 is “Coupon Code included in the order”. Join them with OR. A condition with no rules never matches, so an empty condition hides nothing.

Restricted Shipping and Payment Pro rule builder with rule groups

Groups, the show-only action and the debugger arrived in version 5.0. The Restricted Shipping and Payment Pro 5.0 release post has the full list of changes.

Testing and debugging your rules

To find out which rule hid a method, turn on Debug mode under WooCommerce → Settings → Shipping → Shipping options. Store managers then see a report on the cart and checkout. It lists each enabled condition, whether it matched, what it hid, and the result of every group and rule. Customers don’t see it.

Restricted Shipping and Payment Pro checkout debugger report

WooCommerce’s debug mode also turns off its shipping rate cache, so each change shows on the next refresh. Turn it off when you’re done. A few habits help:

  • Enter a full address, including state and postcode. Shipping conditions aren’t checked until WooCommerce has rates for the address.
  • Test as a guest and as a logged-in customer if any rule checks the customer.
  • Use the Enabled switch in the conditions list to rule a condition in or out, and Duplicate to try a variation.

Simple Table Rates Pro has its own Enable Debug Mode setting. While it’s on, the method is offered only to administrators, and the cart and checkout show which rows matched and the final rate.

Block checkout support

Restricted Shipping and Payment Pro works with the WooCommerce Cart and Checkout blocks and with the classic checkout. In the blocks, condition messages and debugger reports update as the customer changes the cart. When a shipping condition uses the Payment Gateway rule, picking a different payment method refreshes the shipping rates.

Simple Table Rates Pro adds a normal WooCommerce shipping rate, so its prices show in both checkouts. Its Add subtitle text is printed through a classic cart and checkout hook, so check subtitles and customer messages on your block checkout before you rely on them.

Frequently asked questions

Can I hide a shipping method based on the payment method?

Yes. Shipping conditions have a Payment Gateway rule, and payment conditions have a Shipping Method rule. For example, hide express delivery when bank transfer is chosen, or show cash on delivery only for local pickup.

Does Cart Total include shipping and coupons?

No. In both plugins it’s the cart subtotal: products only, before shipping and before coupon discounts.

Can one rule check several emails or roles?

No. The Customer rule takes one email and Customer Role takes one role. Add one rule per email or role in a group set to “Match any of these rules”.

What do the free versions leave out?

The free Conditional Payments and Shipping for WooCommerce has seven rules: Cart Total, Coupon Code, Customer, Package Weight, Billing Country, Shipping Class and Shipping Country. A condition hides its targets when any rule matches. There are no groups, show-only action, customer messages, priorities or debugger. The free Simple Table Rates has Weight, Cart Total, Products, Quantity and Volume rows, the Sum method only, and no row actions.

Do I need both plugins?

Only if you need both jobs. To hide methods or gateways, use Restricted Shipping and Payment Pro. To price shipping by weight, quantity or product, use Simple Table Rates Pro.

Set up your shipping and payment rules with WPRuby

WooCommerce Restricted Shipping and Payment Pro hides or shows shipping methods and payment gateways by location, cart, customer, product and time, with AND/OR rule groups, customer messages and a checkout debugger. WooCommerce Simple Table Rates Pro calculates the rate itself from weight, cart total, quantity, volume, products, roles and more. Use one for each job, or both together.

Leave a Reply

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