Redcase Cash on Delivery for WooCommerce

Description

Redcase Cash on Delivery adds rules to the cash on delivery payment method that ships with WooCommerce. It does not add a new gateway: orders keep the cod payment method, so emails, reports and other plugins see nothing new.

What you can set

  • Extra fee. A fixed amount with your own label, shown as a separate line while cash on delivery is chosen. It can be taxed through any WooCommerce tax class. It is removed as soon as the customer picks another payment method or cash on delivery is no longer offered.
  • Fee per shipping method. A different amount, or no fee at all, for any shipping method entry of a zone, and one for local pickup. When an order ships in several packages, the highest fee applies.
  • Maximum cart value. Products after coupons, including tax, without shipping and fees. A cart equal to the limit is allowed; one cent more is not.
  • Shipping zones. Hide cash on delivery for chosen WooCommerce shipping zones.
  • Countries and states. Based on the shipping address.
  • Postcodes. One line per country, with exact codes and numeric ranges, for example GR: 10000...19999, 84001. Spaces and letter case are ignored and leading zeros are kept.
  • Shipping methods. Hide cash on delivery for a single shipping method entry of a zone, such as one flat rate. If any package of the order ships with it, cash on delivery is hidden for the whole order.
  • Local pickup. One switch hides cash on delivery for every local pickup, for shops that do not take cash at the counter. Left off, local pickup accepts it like any other method.
  • Settings backup. Download the settings as a JSON file and load it again, on the same shop or on another one.

One matching rule is enough to hide cash on delivery. WooCommerce’s own “Enable for shipping methods” setting still applies.

Checkout support

  • Classic checkout (shortcode): totals refresh when the payment method changes.
  • Checkout block: the fee follows the selected payment method through the Store API, and the rules apply to the payment methods the block offers.
  • At placement the rules are checked again, so an older cash on delivery choice is refused.
  • The fee is stored once on the order as a fee line. It shows in order emails, the thank-you page, My Account and the admin order screen.
  • Compatible with High-Performance Order Storage (HPOS).

For developers

Three filters, each with the cart context (total, zone, country, state, postcode, chosen shipping rates) and the settings as extra arguments:

  • redcase_cod_block_reasons: the reasons that hide cash on delivery. Return an empty array to offer it, or add your own reason to hide it.
  • redcase_cod_fee: the fee amount before tax.
  • redcase_cod_fee_label: the name of the fee line, for example per language.

Example, no cash on delivery for a product category:

add_filter( 'redcase_cod_block_reasons', function ( $reasons ) {
    foreach ( WC()->cart->get_cart() as $item ) {
        if ( has_term( 'furniture', 'product_cat', $item['product_id'] ) ) {
            $reasons[] = 'furniture';
        }
    }
    return $reasons;
} );

Privacy

The plugin makes no external requests, collects no data and adds no tracking. It stores its settings in one option.

Translations

English and Greek are included.

Screenshots

Installation

  1. Install and activate WooCommerce.
  2. Install the plugin from Plugins Add New, or upload the ZIP, and activate it.
  3. Go to WooCommerce Settings Payments Cash on delivery and fill in the “Redcase Cash on Delivery” section. The Plugins screen has a “Settings” link to it.

FAQ

Does it replace the WooCommerce cash on delivery gateway?

No. It adds rules and a fee to it. Turn the gateway on or off in WooCommerce as usual.

Why does the cash on delivery settings screen look like the older WooCommerce form?

WooCommerce shows the cash on delivery settings as a new React screen that only holds its own fields. The plugin keeps that one screen on the classic form so its section can be shown under WooCommerce’s fields.

Is the fee amount before or after tax?

When you choose a tax class, the amount you enter is before tax and WooCommerce adds the tax. With “Not taxable” the amount is charged as entered.

How do I find the ID of a shipping method?

The “Disable for shipping methods” list shows every method entry of every zone, for example “Greece — Courier (flat_rate:2)”. Pick the entry itself.

Can I move the settings to another shop?

Yes. Use “Download settings” in the “Settings backup” part, then choose the file under “Load a backup” on the other shop and save. Shipping zones, shipping methods and the fees per shipping method are left out there, because their IDs differ from shop to shop: set those again.

Can I charge a different fee, or none, for local pickup?

Yes. “Fee per shipping method” has a field for every shipping method entry and one for local pickup. Empty means the standard fee, 0 means no fee. To refuse cash on delivery on local pickup, tick “Disable cash on delivery for local pickup”.

Does it work with the order-pay page?

No. The rules apply to the checkout. The order-pay page keeps WooCommerce’s behaviour.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Redcase Cash on Delivery for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.1.0

  • New: a fee of its own for each shipping method entry and for local pickup (empty: the standard fee, 0: no fee).
  • New: a switch that hides cash on delivery for local pickup, including the pickup locations of the Checkout block.
  • New: settings backup. Download the settings as JSON and load them on the same or another shop.
  • New: developer filters redcase_cod_block_reasons, redcase_cod_fee and redcase_cod_fee_label.
  • Fix: a maximum cart value of 0 showed as an empty field and was lost on the next save.
  • Change: requires WordPress 6.8, which loads the bundled Greek translation by itself.

1.0.0

  • First release: fixed fee with label and tax class, maximum cart value, and blocks by shipping zone, country or state, postcode and shipping method entry, on the classic checkout and the Checkout block. English and Greek.