We are facing some issues with logged in users being able to checkout via wordpress's woocommerce. The fix for these few users that reached out to us was to simply clear their cookies. (Because we recently changed servers which mucked things up a bit causing this checkout issue)

So i want to provide a red bar at the top of our checkout and cart pages that recommends to our users that they update the cookies to our site. And provide a button they can click that will remove the cookie for them.


Okay so i have this script.. Which I am told is suppose to work.

<a href="#" class="clearAllCookies">Start your bacon</a>

$(document).ready(function() {
    $(".clearAllCookies").click(function() {
        document.location = "start.html";

However when i open dev tools and select the application tab. I am able to clear my cookie by simply right clicking and selecting clear - at which point it deletes itself and removes itself from the cookie folder.

But when I am in dev tools and use this button script to clear my cookie. The cookie remains in the file unlike if i cleared it manually by right clicking on it in dev tools. So I am unsure if its working or not. How do i properly test this?

Also how do i make it re-direct the user to the login page afterwards?

Any help much appreciated. Not sure if its working.

1 Answer 1


You will need to check if a cookie of your website is set in the user's browser. If so, display a message.

If you'd like to delete all his cookies try this.

  • Thanks! But how do i apply that script you linked to a button click? Can u give an example of that in your answer? Many thanks!
    – Patrick
    Mar 21, 2017 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.