Sami

How to add Processing fee In Woo commerce cart Total.

  1. Create a Child Theme.
  2. Open Functions.php file.
  3. Paste Following Code.
  4. 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, '' );

}

Leave a Reply

Your email address will not be published. Required fields are marked *