I have started using WooCommerce since year 2012 and i like it because it provides me many customized options to suit my needs or client requirement.

Case Study:One of the possible situation is where i need to disable the shopping cart. In this way, the customer only can buy one item, if the customer goes to another product and tries to buy it, the cart will be cleaned and the last item added.

 

Solution:

Open your theme functions.php, and put below code at the end.

add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );

function woo_custom_add_to_cart( $cart_item_data ) {
global $woocommerce;
$woocommerce->cart->empty_cart();

return $cart_item_data;
}

Finally, save the file. And now you can test by adding new product to your existing cart with items, see whether it will added the latest product only and remove all previous products in the cart.