1

I want to automatically empty complete Woocommerce cart from products after 5 minutes. Is there a way to programmatically do so?

Marko I.
  • 542
  • 10
  • 38

1 Answers1

0

First set a Session or cookie with current time on woocommerce_add_to_cart hook.

Once page load, You can check with init hook if difference between current time and session time is more then 300 second then you can clear cart.

global $woocommerce;
$woocommerce->cart->empty_cart(); 
Vicky P
  • 553
  • 6
  • 12