guillermorangel
1/24/2015 - 1:39 AM

http://www.yojance.net/511/set-minimum-weight-per-order-in-woocommerce/

<?php

add_action( 'woocommerce_check_cart_items','yr_minimum_weight_req_before_checkout' );
function yr_minimum_weight_req_before_checkout() {
	global $woocommerce;
	// Set the minimum weight before checking out
	$minimum_weight_required = 100;
	// Get the Cart's content total weight
	$weight = $woocommerce->cart->cart_contents_weight;
		// Compare values and add an error is Cart's total weight
		// happens to be less than the minimum required before checking out.
		// Will display a message along the lines of
		// Minimum Weight of 100kg Must Be Met. Return to Shop
		if( $weight < $minimum_weight_required )
			$woocommerce->add_error( 'Minimum Weight of '. $minimum_weight_required
			. get_option( 'woocommerce_weight_unit' ) 
			.' Must Be Met. <a class="button" href="'
			. get_permalink( woocommerce_get_page_id( 'shop' ) ) 
			.'">&larr; Return To Shop</a>'  );
}

?>