Deny checkout based on cart weight

If you want to restrict orders based on a maximum or minimum order weight, you can do so with the following code. This function displays an error message for total cart weights above 100 in three places – on the cart page, on the checkout page and when an order is initiated. The order will not be processed until the cart has been revised to bring the weight below the maximum.

If you are setting these limits to an order it is also a good idea to display the total weight on cart and checkout pages.