WooCommerce Add Handling Fee For Orders Over Specific Amount
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' ) ) return; $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.
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.