How to clear cart after login?
-
Hi to the community,
I have a WooCommerce + Tutor LMS. WooCommerce shop_page and product pages are hidden, same for the WP search results. The only way of purchasing a product is through a Tutor course page. Users can’t purchase more than one of the same product (course) – easily set up in WooCommerce.
During the testing I found a way how customers still can buy products already purchased in the past (which doesn’t make sense for a lifetime access to a course) – simply by adding products into the cart as a visitor and logging in after.
I tried to search for some solutions (typically snippets) but all of them involve ‘adding to cart’ restrictions. Adding product via Tutor course page as a visitor, loggin in and buying after that is still possible though.
I would be pleased with ANY solutions. In my opinion, the simpliest one would be clearing the cart automatically after every login. Not sure if it won’t cause another issues though (e.g. being impossible to purchase a course for newcomers without an account). Does anyone can advise on how to do this?
Thanks & cheers!
(Keep in mind I’m no developer.)
- The topic ‘How to clear cart after login?’ is closed to new replies.