Product Icon

WooCommerce

Sell online with the flexible, customizable ecommerce platform designed to grow with your business. From your first sale to millions in revenue, Woo is with you. See why merchants trust us to power 4+ million online stores.

Add fees to order without tax

There is no option to manually add fees to an order without tax from the admin order screen. It automatically applies the default order tax, but there is no way to remove the tax. Setting the tax amount to zero doesn’t work, because recalculating will add the tax amount back.
It would be nice to be able to, when adding fees to an order manually, have the option to exclude the fee from taxes for more flexibility.

Author

webmixnl

Current Status

Open

Last updated: August 1, 2024

1 comment

Log in to comment on this feature request.

  1. inobysro says:

    There is currently no official way to add a non-taxable fee to an existing order via the WooCommerce admin or API—WooCommerce always recalculates taxes for fees based on the order’s tax settings. The only reliable workaround I found is to manually update the fee’s tax values directly in the database after the fee is added. Specifically, you need to set the _line_tax and _line_tax_data meta fields for the fee item to zero. This way, the fee will remain non-taxable even after recalculating totals.

    It’s a hack, but it works until WooCommerce adds native support for non-taxable fees on existing orders.

    example:

    global $wpdb;
    $order_item_id = $fee->get_id();
    $wpdb->update(
    $wpdb->prefix . ‘woocommerce_order_itemmeta’,
    array(‘meta_value’ => ‘0’),
    array(‘order_item_id’ => $order_item_id, ‘meta_key’ => ‘_line_tax’)
    );
    $wpdb->update(
    $wpdb->prefix . ‘woocommerce_order_itemmeta’,
    array(‘meta_value’ => ‘a:1:{i:1;s:1:”0″;}’),
    array(‘order_item_id’ => $order_item_id, ‘meta_key’ => ‘_line_tax_data’)
    );