We can add an additional charge for only cash on delivery (COD) in woocommerce shopping cart website.

Please add the below function code in Appearance >> Theme Editor >> Theme Files >> function.php file (we recommend you to use child theme).

To activate Child Theme go to Appearance >> Themes >> Activate Child Theme of your active Theme.

In this code I have added 40 as Handling Charges( ‘$fee = 40;’ ) you can change this.

Code Copied From https://www.creativetweets.com/how-to-add-an-additional-charges-for-cash-on-delivery-payment-method-cod-in-woocommerce/

Buy Premium Themes & Plugins From www.gplchamp.com

				
					// Add a custom fee based o cart subtotal
add_action( 'woocommerce_cart_calculate_fees', 'custom_handling_fee', 10, 1 );
function custom_handling_fee ( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;
 
    if ( 'cod' === WC()->session->get('chosen_payment_method') ) {
        $fee = 40;
        $cart->add_fee( 'Handling Charges', $fee, true );
    }
}
 
// jQuery - Update checkout on methode payment change
add_action( 'wp_footer', 'custom_checkout_jqscript' );
function custom_checkout_jqscript() {
    if ( is_checkout() && ! is_wc_endpoint_url() ) :
    ?>
    
    <?php
    endif;
}