How Can I Get Category Data From The Cart Products

Hi

I want to prevent my customers from buying products in two different categories.

Is there a way to get category data from the cart products?

I think I need to use the fn_get_cart_products hook, but I couldn’t figure out how .

Thank you in advance.

You can use hooks in the fn_add_product_to_cart function (app/functions/fn.cart.php). So when a customer adds product to cart, the system will check existent products in cart