woocommerce_cart_calculate_fees

The woocommerce_cart_calculate_fees action runs when WooCommerce calculates cart fees. It passes the $cart (WC_Cart) object to callbacks, which can use $cart->add_fee() to add an amount before the final cart totals are calculated. This is an action, so callbacks do not return a fee array.

Add a small-order fee

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

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

This adds a non-taxable fee of five units of the store's currency when the item subtotal before coupons is below 50. The optional $taxable argument defaults to false. Adjust the amounts and tax treatment for your store, and test the resulting totals on a staging checkout. For the method signature and defaults, see the WooCommerce cart reference.

What the threshold measures

get_subtotal() checks the items' subtotal before coupon discounts. A coupon that reduces the amount payable below 50 will not, by itself, trigger this fee. If the rule should depend on a discounted amount, choose a different calculation deliberately rather than assuming the subtotal means the final amount due.

WooCommerce recalculates fees with cart totals; fees added through this action are not permanent charges stored independently of the cart. Each fee name must be unique within a calculation, and add_fee() does not support a negative amount. Use an appropriate discount mechanism instead of a negative fee. Test alongside your tax, shipping, and payment configurations before charging customers.