How to Add a Small-Order Fee in WooCommerce Without a Plugin

Add a small fixed fee when a WooCommerce cart falls below your chosen subtotal, with a PHP snippet and clear guidance on coupons, taxes, and checkout.

Last updated:

Reviewed for accuracy by Jesse Nickles

Add the small-order fee

Back up your store and test on staging first. Add the following PHP inside your active child theme's functions.php, without a second opening <?php tag, or use a site-specific plugin. HoverCraft users can follow the child theme instructions. The example charges 5 when the product subtotal is below 50 in your store's currency, before coupon discounts. If coupons should count toward the threshold, use the adjustment in the next section.

add_action( 'woocommerce_cart_calculate_fees', function ( $cart ) {
    if ( is_admin() && ! wp_doing_ajax() ) {
        return;
    }

    $minimum = 50.00;
    $fee     = 5.00;

    if ( $cart->get_subtotal() < $minimum ) {
        $cart->add_fee( 'Small order fee', $fee, false );
    }
} );

Replace 50.00 with your subtotal threshold and 5.00 with the fee. The condition applies to the cart's products, including virtual products; it does not automatically exclude products, categories, or customer groups, or check whether shipping is required. Those restrictions would need additional conditions.

The woocommerce_cart_calculate_fees hook runs whenever WooCommerce calculates cart fees. Its add_fee() method adds the charge for the current calculation rather than storing it permanently.

Decide whether coupons count toward the minimum

The snippet uses get_subtotal(), which excludes coupon discounts. At a threshold of 50, a cart with 49 in products gets the 5 fee; a cart with exactly 50 does not. A cart with 55 in products and a 10 coupon also avoids the fee under this default rule, even though its discounted item total is 45.

To add the fee when the discounted product amount is below 50, replace only the if line with:

if ( $cart->get_cart_contents_total() < $minimum ) {

With that alternative, the 55 cart and 10 coupon incurs the fee because 45 is below the threshold. Both calculations exclude shipping and tax. If your storefront displays tax-inclusive prices, the amounts shoppers see may differ from these tax-exclusive subtotals. Do not compare the final order total here: it includes other charges and is not complete when WooCommerce calculates fees.

Choose the fee's tax treatment

The false in add_fee( 'Small order fee', $fee, false ) tells WooCommerce to treat the fee as non-taxable; it does not determine whether the fee is legally exempt from tax. Check the rules that apply to your store before changing it to true. For a taxable fee, the optional fourth argument specifies a configured tax-class slug, or you can leave it blank for the standard class.

You can rename Small order fee to a customer-friendly label, but fee names must be unique within a calculation. Do not enter a negative fee to create a discount. The same server-side hook supports classic cart and checkout as well as Cart and Checkout blocks; test the actual flow your store uses. See WooCommerce's blocks FAQ for fee support.

Test before going live

  1. Try a cart with 49, exactly 50, and 55 in products, using the store's currency. Check that the fee appears only where your chosen threshold rule requires it.
  2. Apply a 10 coupon to the 55 cart. Confirm that the fee is absent with get_subtotal() or present with get_cart_contents_total().
  3. Check the fee label, tax treatment, and whether it appears only once. Test both cart and checkout, including quantity changes and your mobile layout.
  4. If your store sells virtual products, or displays tax-inclusive prices, verify that those carts behave as intended.

If the fee does not appear, check that the PHP loads and that the calculated subtotal is below the threshold. If it appears twice, look for another fee snippet or extension. A fee still permits checkout; to prevent orders below a threshold instead, see the minimum order amount guide.