Hey friends, Today i share a little trick for only allow one product in the cart WooCommerce. Sometimes we need to checkout only one item from the shop. For example like membership website here we need only one plan as a product for membership. You can add this code in functions.php of theme or plugin. This code gives you right to add only one product in shop cart of WooCommerce. woocommerce_add_to_cart_validation is woocommerce hook for cart validations. With help of this hook we can empty cart and add single product.
Thanks for visit.