Support » Plugin: WooCommerce » Get Category of Item in Cart

  • Hi all,

    I’ve been trying at this for a bit, but haven’t gotten the results I need yet.

    I have setup a restricted area of my WooC site for Wholesalers only, and within this there are different delivery dates (set as different categories for easier control). I am using the WooC Pre-Orders plugin to allow for different delivery dates, and have modified its code to allow for the addition of multiple items as preorders.

    What I would like to do is check each item being added to the cart, compare its category to the items already in the cart, and if it is different, empty the cart and provide a message to the user that only one delivery date can be checked out at a time.

    I’ve been able to do all of this, minus accurate values for the category of each item. I’ve also looked through the API quite thoroughly but can’t seem to find what I’m looking for.

    Does anyone know how to get the category of an item in the cart directly?

    https://wordpress.org/plugins/woocommerce/

  • The topic ‘Get Category of Item in Cart’ is closed to new replies.