I have a function that I call with ?clear-cart appended to the end of my page; as you can probably guess, this function clears the user\'s cart.
?clear-cart
I call it l
Something along the lines of this should do what you want:
if (isset($_GET['clear-cart'])) { clear_cart(); header('Location: http://test.local/'); }
Modify to suit your needs.