How do I add a fee to the invoice?

In order to add a fee to WooCommerce and your invoice, simply add the following action to your themes  functions.php

function add_woocommerce_fee() {
    global $woocommerce;


    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;


    $amount = 5;
    $woocommerce->cart->add_fee( 'FEE_NAME', $amount, true, 'standard' );
}
add_action( 'woocommerce_cart_calculate_fees','add_woocommerce_fee' );

Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.

Still need help? Contact Us Contact Us