Bloodweb International Fees and Coupons

Import duties and regional discount codes for WooCommerce in one plugin. Set fees and coupon rules by country or by whole continent, conditional on the shipping method and the order value. Replaces Tariff Manager and Regional Coupon Restrictions, importing the settings from both.

WooCommerce v4.5.0

Bloodweb International Fees and Coupons for WooCommerce

  • Contributors: bloodweb
  • Tags: woocommerce, import duty, tariff, coupons, shipping
  • Requires at least: 5.0
  • Tested up to: 7.1
  • Requires PHP: 7.4
  • Stable tag: 4.5.0
  • License: GPLv2 or later
  • License URI: https://www.gnu.org/licenses/gpl-2.0.html

Charge import duties and offer discount codes by country or by continent in WooCommerce, with per-rule shipping and order-value conditions.

Description

Set a fee or a discount code against a region, and let the region be either a single country or a whole continent. An order to Zimbabwe can owe an Africa-wide import duty and still use a code you wrote for Zimbabwe alone.

Every rule carries its own conditions, so a fee or a code can apply only above a certain order value, or only when a particular shipping method was chosen.

The plugin is free, calls nothing on the internet and stores no customer data. It reads the destination on the order in front of it and applies your rules.

Regions

A rule belongs to a region, and a region is either a continent or a single country. A country picks up its continent's rules as well as its own:

Africa (all countries) Fee Import duty, 5.5%, any shipping method Coupon FREESHIP, $40, only with STD - International Tracked

Zimbabwe Coupon ZIMBABWE, $100, only on orders over $100

An order to Zimbabwe owes the Africa-wide import duty, and may use either the Africa-wide FREESHIP code or Zimbabwe's own, whichever suits it.

Continent membership comes from WooCommerce itself, so it stays correct without a bundled country table going stale.

How fees combine

Two fees on the SAME region always stack. Germany carrying 10% VAT and a $100 import fee charges both: a $100 order becomes $210. Two fees entered against one country are two things owed, not a choice.

When a country and its continent BOTH have fees, the store decides, under WooCommerce -> Fees and Coupons:

  • Stack - every matching fee is charged
  • Highest only - only the single largest matching fee
  • Country first - the country's fees, falling back to the continent's
  • Continent first - the continent's fees, falling back to the country's

Each fee appears as its own line in the cart, so a customer can see what they are being charged for.

Coupons

Codes are created as real WooCommerce coupons, so they are typed into the usual box, appear in reports and behave normally everywhere else. What WooCommerce cannot express natively, which is the region, the shipping method and the order-value condition, is enforced by this plugin.

"Stackable coupons" decides whether a customer who qualifies for several of these codes may use more than one. Coupons from other plugins are never affected.

Codes you remove here are never deleted from WooCommerce, because past orders reference them, but they stop being accepted at checkout.

The same code can be listed under several regions, and it is accepted for an order to any of them. It takes its amount from the first region it is listed under.

Explaining a fee to the customer

Each fee can carry a "What is this?" note. When it has one, a "?" appears beside that fee in the cart and checkout totals, and clicking it opens the note in a row directly underneath. A fee with no note gets no "?".

The note is plain text written on the settings screen, so it can say what the charge is for in the store's own words rather than leaving a customer to guess at a line item they did not expect.

On the classic cart and checkout the note opens in a row directly under its fee. The Cart and Checkout blocks offer no hook on an individual fee row, so there the notes gather in a short "About these charges" list under the order summary, in the same order as the fees above them.

Shipping costs

Three independent switches, because the answer differs per store:

  • Include shipping in fee calculations - a 5% fee on goods, or goods plus postage
  • Include shipping in coupon discounts - a 10% code off goods, or off the lot
  • Include shipping in order value conditions - "over $100" before or after postage

Moving over from our earlier plugins

This replaces two plugins of ours that asked the same question, which is where is this order going, and answered it two different ways. Tariff Manager knew about countries. Regional Coupon Manager knew about lists of countries. Neither knew about continents, and neither could say "only with this shipping method" or "only above this order value".

On activation the plugin imports whatever those two left behind. Their own options are read, never written, so deactivating and going back is possible. A coupon that covered five countries becomes that code against five regions.

Tariff Manager's global shipping-method and cart-value settings become per-rule conditions, which is where they belong now that every rule carries its own. A store that set both a minimum and a maximum cart value keeps the minimum.

Installation

  • 1. Install and activate WooCommerce first. This plugin does nothing without it and will say so on the plugins screen.
  • 2. Upload the plugin through Plugins -> Add New -> Upload Plugin, or install it from the WordPress.org directory.
  • 3. Activate it. If Tariff Manager or Regional Coupon Manager were ever set up on this site, their rules are imported now and a notice says so.
  • 4. Go to WooCommerce -> Fees and Coupons, add a region, and give it a fee or a code.

Frequently Asked Questions

Does this replace WooCommerce's own coupons?

No. It creates real WooCommerce coupons, so customers type them into the normal coupon box and they show up in WooCommerce reports like any other. The plugin only adds the conditions WooCommerce cannot express on its own: the region, the shipping method and the order value.

If I delete a code here, is the WooCommerce coupon deleted too?

No. Past orders reference their coupons, so the WooCommerce coupon stays, but it is no longer accepted at checkout. To use the same code as an ordinary store-wide coupon, delete it under Marketing -> Coupons and create it again.

Where does the list of countries in each continent come from?

From WooCommerce. Nothing is bundled, so the mapping cannot drift out of date as WooCommerce updates.

Does the plugin send anything to an external service?

No. There are no outbound requests, no analytics and no accounts. Fees and coupon rules are stored in your own WordPress options table.

A country and its continent both have a fee. Which one is charged?

Whichever you chose under WooCommerce -> Fees and Coupons: stack both, take the highest only, or prefer one level and fall back to the other. Two fees on the same region always stack regardless.

Does this work with the cart and checkout blocks?

Yes, all of it. Fees and coupon rules are applied while the cart is calculated, so they hold on the blocks exactly as they do on the classic templates.

The notes are placed differently, because the blocks give no hook on an individual fee row. On the classic templates a note opens directly beneath its fee. On the blocks the notes gather in a short "About these charges" list under the order summary, in the same order as the fees.

Does it work with High-Performance Order Storage (HPOS)?

Yes, and it says so to WooCommerce. The plugin never reads or writes orders itself: fees are added to the cart, and WooCommerce records them on the order the usual way, whichever order storage the store uses.

I used Tariff Manager or Regional Coupon Manager. Do I lose my settings?

No. They are imported when you activate this plugin, and the old options are left untouched so you can go back.

Screenshots

  • 1. Global settings: how country and continent fees combine, coupon stacking, and which totals include shipping.
  • 2. A region with its own fees and coupon codes, each with its shipping-method and order-value conditions.
  • 3. Two fees stacking in the classic cart totals, an EU-wide VAT and Germany's own handling charge, with the "What is this?" note opened underneath.
  • 4. The same two fees on the Cart block, with their notes gathered under the order summary.

Changelog

4.5.0

  • New name: Bloodweb International Fees and Coupons for WooCommerce. Your rules, fees and coupon codes carry over unchanged.

4.4.1

  • Declares compatibility with WooCommerce High-Performance Order Storage and the Cart and Checkout blocks, so WooCommerce no longer lists the plugin as incompatible with either. Tested on the blocks: fees, their notes and region-limited codes all work there.

4.4.0

  • Fixed: two fees with the same name, such as an EU-wide and a German "Import duty" stacking, now both charge. Previously WooCommerce kept only one.
  • Fixed: a code listed under several regions now works for all of them, not only the first. Codes imported from Regional Coupon Manager are listed this way.
  • Fixed: a code taken out of the rules is no longer accepted as an ordinary coupon for every destination.
  • Fixed: the first save on a new site, and an import on activation, now create the WooCommerce coupons straight away.
  • Fixed: the "What is this?" notes were missing from the Cart and Checkout blocks in 4.3.0.
  • Fixed: shop managers can now save the settings, not only administrators.
  • The settings screen text is now fully translatable, and a save now says it was saved.
  • Renamed everything global to a longer twifc_ prefix, so it cannot collide with other plugins. Add-ons need the new hook names: twifc_rule_fields, twifc_sanitize_rule, twifc_conditions_met, twifc_fee_base and the twifc:rules-added event.

4.3.0

  • Added extension points so an add-on can put its own fields on a rule and have them saved, narrow when a rule applies, and change the amount a percentage is worked out on: ifc_rule_fields, ifc_sanitize_rule, ifc_conditions_met and ifc_fee_base.
  • Each fee now records which region charged it, so an add-on can report on it after the order is made.
  • The settings screen fires ifc:rules-added when a rule or region is added, so add-on fields can set themselves up on the new copy.

4.2.0

  • The "What is this?" notes now work on the Cart and Checkout blocks, which previously showed a fee with no explanation at all.
  • Notes are listed in the same order as the fees they explain.
  • Fixed a fatal on PHP 7.4, which the plugin claims to support: a WordPress 5.9 function was being called unconditionally.
  • Coupon sync failures now go to WooCommerce -> Status -> Logs instead of the PHP error log.

4.1.0

  • Each fee can now carry a "What is this?" note, shown from a "?" beside the fee in the cart and checkout totals.
  • The note renders in the amount cell when JavaScript is unavailable, so it is never hidden entirely.

4.0.0

  • First release of the merged plugin, replacing Tariff Manager and Regional Coupon Manager.
  • Regions can now be a whole continent, with continent membership read from WooCommerce.
  • Every fee and coupon carries its own shipping-method and order-value conditions, instead of one global setting.
  • Added the choice of how country and continent fees combine: stack, highest only, country first or continent first.
  • Settings from both predecessor plugins are imported on activation and left in place.

Upgrade Notice

4.5.0

A new name only. Nothing to reconfigure.

4.4.1

WooCommerce stops flagging the plugin as incompatible with HPOS and the Cart and Checkout blocks. Nothing to reconfigure.

4.4.0

Fixes same-named fees, codes shared across regions, and removed codes still working. Add-on authors: hooks now use the twifc_ prefix.

4.3.0

Adds extension points for add-ons. Nothing changes for existing rules and there is nothing to reconfigure.

4.2.0

Fee notes now appear on the Cart and Checkout blocks, where they were missing entirely. Also fixes a fatal on PHP 7.4. Nothing to reconfigure.

4.1.0

Fees can now explain themselves in the cart with an optional "What is this?" note. No settings change and nothing to redo after updating.