Sometimes you want to clear cart content.For example, if the customer was redirected back to your WooCommerce store after payment,you need to clear WooCommerce shopping cart to avoid dumplicated order.so how?
global $woocommerce; $woocommerce->cart->empty_cart();
Keep in mind the $woocommerce is a global variable. you need to explicitly declare before you can call it in function or methods.
To clear cart only for some special page, you can detect page with function is_page() which you can pass any page title, ID or slug.