WordPress.org

Plugin Directory

CatCode Conditional Shipping and Payment Rules for WooCommerce

CatCode Conditional Shipping and Payment Rules for WooCommerce

Description

WooCommerce shows every shipping method and every gateway that fits the zone. Real shops often need less than that: no cash on delivery for guests, free pickup only for wholesale accounts, no courier for small orders, a separate set of gateways for customers abroad.

This plugin turns that into rules you can read: hide (or keep only) these shipping methods or these payment gateways when the cart in front of you looks like this.

Conditions

  • Customer role — including “guest” (anyone not logged in) and “any logged-in customer”.
  • Country — the shipping country, or the billing country in shops that do not ship.
  • Cart total — from / to, including or excluding tax, goods only or goods plus shipping (for payment rules).

Every filled-in condition has to hold. An empty condition is not a condition — it is simply not checked.

As many rules as you need

Rules run in priority order, lowest number first, and each one narrows what is left — a later rule cannot bring back a method an earlier one removed. Every rule can be switched off without deleting it.

Both checkouts, one decision

The classic checkout and the block checkout obey the same rules from the same PHP. Shipping rates are filtered where WooCommerce calculates them. For payment gateways the block checkout also asks on the client, and the answer it gets is the decision PHP already made and sent along with the cart, so a hidden gateway is refused by the Store API as well — it is not only hidden on screen.

The shipping-rate cache

WooCommerce caches the calculated rates in the session under a hash of the shipping package. The shopper’s role, the plugin settings and the rules themselves are not part of that package, so the plugin adds them as one extra key: the cache is refreshed exactly when the answer changes, and saving the rules refreshes it for every visitor.

Never a dead checkout

If the rules would remove every shipping method or every gateway, the full list is handed back instead and a line goes into the log. You can switch that guard off when “nothing available for this segment” is genuinely what you want.

Other details

  • Rules do not touch orders created by hand in wp-admin — they are about what a shopper may pick.
  • Optional log of every decision in WooCommerce Status Logs, source “ccsr”.
  • Compatible with High-Performance Order Storage (HPOS) and the Cart and Checkout blocks.
  • No external services, no tracking, nothing is sent anywhere.

Installation

  1. Upload the plugin and activate it (WooCommerce must be active).
  2. Open WooCommerce Shipping & payment rules.
  3. Edit the example rule or add your own: pick “Hide” or “Keep only”, pick the methods, fill in the conditions, switch the rule on and save.

FAQ

A method is still showing after I saved the rule

Rules only run on the storefront. Check that the rule is switched on, that the method you picked is the one the zone actually offers (the picker shows the rate id in brackets), and that the conditions really match your test cart. Switch on the log in the settings and look at WooCommerce Status Logs, source “ccsr” — every decision is written there.

Does it work with the block checkout?

Yes. Shipping methods are filtered on the server, so the block checkout sees the same list. Payment gateways are filtered on the server as well, and the block checkout is told the same decision through the Store API, because that checkout decides on the client too.

I hid everything and now nobody can order

“Never leave the checkout with no method at all” is on by default and hands the full list back if the rules empty it. If you switched it off, switch it back on.

Can I hide cash on delivery for guests?

Yes — that is the example rule the plugin ships with (switched off). Open it, switch it on and save.

Does it change shipping prices?

No. It decides which methods are offered; prices stay with WooCommerce and your shipping plugins.

What happens to the settings when I delete the plugin?

Deleting the plugin from the Plugins screen removes its options (settings and rules).

Reviews

There are no reviews for this plugin.

Contributors & Developers

“CatCode Conditional Shipping and Payment Rules for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.1

  • While the Pro version is active, WooCommerce no longer lists this switched-off copy as incompatible with its features (HPOS, block checkout).

1.0.0

  • First release.