Zum Inhalt springen

Fee recipes

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

These recipes use only what the free edition does: a label, a fixed or percentage amount, the taxable option and the per-fee enable toggle. Each one is a single row you add under WooCommerce → Surcharge. The free plugin has no built-in conditions; the last section shows how a developer (or the planned Pro add-on) can add them in code.

A fixed charge added to every order.

  • Label: Handling fee
  • Type: Fixed amount
  • Amount: 3.00
  • Taxable: off (unless your accounting taxes it)

The fee adds 3.00 once to the cart and shows as its own totals line on cart, checkout and the order.

Pass on a card-processing percentage across the cart.

  • Label: Card processing
  • Type: Percentage of cart
  • Amount: 2.5
  • Taxable: match your accounting

The fee is 2.5% of the cart contents subtotal (including line tax), calculated before shipping and any other fees. On a 100.00 subtotal it adds 2.50. Percentages are capped at 100.

If the surcharge itself must be taxed, tick Taxable. WooCommerce then applies your standard tax rate to the fee just like a product line. Leave it off and the fee is added tax-free. This is the only tax control, there is no per-rate selection.

Each row is independent and is evaluated separately, so more than one fee can apply to the same cart, for example a handling fee plus a percentage processing fee. Each shows as its own line in the totals.

If two fees share the same Label, Surcharge suffixes the second with #N so they stay as distinct lines rather than collapsing into one. Give them different labels if you want clean wording.

To stop charging a fee but keep it ready to bring back, untick its Enabled box and save. The row and its values are kept; the fee just stops applying. To pause every fee at once, turn off the Enable fees master switch instead.

The free edition applies every enabled fee whenever the master switch is on. To make fees conditional, hook the surcharge/fee_applies filter. Surcharge runs it once per cart calculation after the master switch passes; return false to skip all fees for the current request. This is the same extension point the planned Surcharge Pro add-on uses.

Charge fees only when paying Cash on Delivery:

add_filter( 'surcharge/fee_applies', function ( bool $applies ): bool {
if ( ! function_exists( 'WC' ) || ! WC()->session ) {
return $applies;
}
return WC()->session->get( 'chosen_payment_method' ) === 'cod';
} );

Skip fees below a cart minimum:

add_filter( 'surcharge/fee_applies', function ( bool $applies ): bool {
if ( ! function_exists( 'WC' ) || ! WC()->cart ) {
return $applies;
}
return $applies && WC()->cart->get_subtotal() >= 50.0;
} );

The filter is all-or-nothing per request, it cannot turn a single fee on or off while leaving the others. Per-fee conditions are on the Pro roadmap.