How to add Processing fee In Woo commerce cart Total.
- Create a Child Theme.
- Open Functions.php file.
- Paste Following Code.
- Save file
/**
* Add a 8% surcharge/fee to your cart / checkout
* change the $percentage to set the surcharge to a value to suit
*/
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$percentage = 0.08;
$surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;
$woocommerce->cart->add_fee( 'Processing fee', $surcharge, true, '' );
}