I am wondering how you can clear the contents of your cart on page load using woocommerce.
I came accross how to add a clear cart button using by adding this in to f
None of the above codes worked on my Wordpress installation (4.9.6). So, I changed the add_action and removed the variable request and went directly to run.
Now my Woocommerce plugin clears products to cart once user exits checkout page without any duplicate errors. Thank you everyone for your help
add_action( 'woocommerce_add_cart_item_data', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
global $woocommerce;
$woocommerce->cart->empty_cart();
}