WooCommerce Add Handling Fee For Orders Over Specific Amount

About The Author
Cabe Nolan is the founder of WP Cover where he shares his insight into WordPress, development, & entrepreneurship. Outside of WPCover, Cabe continues to run a successful WordPress development firm, Bold City Design as well as a few high profile websites, Arrivala, Two Way Resume, Dock Skipper, and a successful outdoors brand, DolfinPack.

WooCommerce Add Handling Fee For Orders Over Specific Amount

Today I’m sharing a quick code snippet that was recently implemented for one of my clients.  The client has a WooCommerce powered online store and has found a very successful niche.  He often ships fragile goods and when the orders get large, it takes extra time to pack, handle, and ship the goods.  He requested the addition of a $10.00 handling charge for orders where the sub-total was greater than $100.

Easy enough!

With a little thought and some quick research, we implemented the following custom function in the active themes functions.php file:

add_action( 'woocommerce_cart_calculate_fees','wpcover_handling_fee' );
function wpcover_handling_fee() {
     global $woocommerce;
     if ( is_admin() && ! defined( 'DOING_AJAX' ) )
          $subtotal = WC()->cart->get_subtotal();
          //set our subtotal amount
		    if($subtotal > 100) {
			    //set our fee amount
		     	$fee = 10.00;
		     	//you can change the title of the fee as it appears in the cart
		     	$woocommerce->cart->add_fee( 'Handling', $fee, true, 'standard' );

That’s all there is to it! Enjoy.


  1. jessicaheins says:

    Hello, this info is good, can you please explain How can i use or merge woocommerce with other plugins like

    I want to use woocommerce with affiliate plugins and membership plugins.

Share Your Thoughts

Leave a Reply

Your email address will not be published.

Related Stuff You Might Like

WordPress News, Tips, & Code Snippets

Join the WP Cover mailing list and get wordpress news, tips, code snippets, security warnings, and more delivered right to your inbox.  We won't flood your inbox, newsletters typically go out every 1-2 weeks unless it involves an important security release.

You have Successfully Subscribed!