Empty cart once a user leaves a certain page in Woocommerce
问题 So we're building a site that has a custom page that's calling the items in a WooCommerce cart. But what we wanted to do is empty that cart once a user leaves that page. Is this possible? We found this code that will maybe help us but we kept getting a fatal error when we go to the admin page and this only seems to happen when we go to the admin section: Fatal error: Call to a member function empty_cart() on null in /home/client/public_html/wp-content/themes/wp-theme/functions.php on line 746