WooCommerce Cart Redirects to Homepage: Find the Cause Fast

A method that finds the exact code redirecting your WooCommerce cart to the homepage, usually in under ten minutes, even after the obvious checks have failed.

A shopper sent back to the homepage by a redirect instead of reaching the WooCommerce cart page

The cart page sends everyone to the homepage. The page is published, it is assigned correctly in WooCommerce settings, permalinks have been resaved, the htaccess file is clean, and the SEO plugin has no redirects configured. People lose entire weeks to this one.

They lose weeks because the standard advice is a list of things to check, and once you have checked them all there is nowhere else to go. This guide is a method instead. It finds the specific line of code sending the redirect, usually inside ten minutes, and it works even when the usual suspects have already been ruled out.

Stop changing things and start observing

The reason this drags on is that people respond by making changes. They rebuild the cart page, switch the template, deactivate plugins in batches, try a different theme. Each change takes time, affects live customers, and tells you very little.

A redirect is an observable event. WordPress will tell you who sent it if you ask correctly. Four observations are usually enough.

Observation one: is it really a server-side redirect?

Request the URL with redirects disabled and read the status code:

curl -I https://example.com/cart/

A 301 or 302 arriving before any page content means PHP sent it. If instead you get a 200 and the browser still moves, it is JavaScript, and you are looking at your theme or a page builder widget rather than a redirect rule. These are completely different investigations, so settle this first.

Observation two: read the X-Redirect-By header

This is the most useful and least known part. Any redirect sent through the WordPress wp_redirect function carries a header naming its caller. Look at the response headers in the browser Network tab with Preserve log enabled, or in the curl output above.

  • A plugin name tells you the answer immediately.
  • A bare WordPress value means something called the function without identifying itself, which still rules out htaccess, your CDN and the server.
  • No such header at all means the redirect did not come from WordPress, so look at the server configuration, the host, or a reverse proxy.

Observation three: treat checkout as a symptom

If both cart and checkout redirect, do not investigate them as two problems. WooCommerce sends an empty checkout to the cart page by design, so a broken cart drags checkout with it. Fix the cart and checkout usually resolves itself. Investigating both in parallel doubles the work for nothing.

Observation four: get the stack trace

If the header did not name the culprit, make WordPress tell you what called it. Drop a small file into wp-content/mu-plugins so it loads on every request:

<?php
add_action( 'muplugins_loaded', function () {
    header( 'X-Trace-Loaded: 1' );
} );

add_filter( 'wp_redirect', function ( $location, $status ) {
    header( 'X-Trace-Redirect: ' . $status . ' ' . $location );
    header( 'X-Trace-Stack: ' . substr( wp_debug_backtrace_summary(), 0, 900 ) );
    return $location;
}, 1, 2 );

Then request the page and read the headers. The result tells you exactly where you stand:

  • No X-Trace-Loaded header at all means the file is not in the folder WordPress is actually using. Confirm the document root in your hosting panel, because you may be editing a different copy of the site than the one being served.
  • X-Trace-Loaded present but no X-Trace-Stack means the redirect happens before WordPress redirect handling, so look at server rules.
  • X-Trace-Stack present gives you the call chain, which names the function and file responsible.

Use response headers rather than a log file. Debug logging only writes when both WP_DEBUG and WP_DEBUG_LOG are true and both constants sit above the stop editing line in wp-config.php, and when those conditions are not met the output goes somewhere else entirely. Headers come back on the same request every time, with nothing to configure.

Two traps that waste the most time

Snippets stored in the database

If a code snippets plugin is installed, its snippets live in the database, not in files. Searching your theme and mu-plugins for redirect code will never find them. Pause them all at once without deactivating anything by adding this to wp-config.php, testing, then removing it:

define( 'CODE_SNIPPETS_SAFE_MODE', true );

Your browser and your cache are lying to you

Browsers cache a 301 aggressively. Once Chrome or Firefox has seen one, it will keep sending you to the homepage without ever contacting the server. Always test in a private window, and append a throwaway query string to defeat both the browser and any page cache:

https://example.com/cart/?t=1

A related tell worth knowing: if the lowercase URL redirects but the same path in different capitalisation loads the page normally, something is matching that exact string. That points at a snippet or a redirect rule rather than anything structural, and it rules out your page assignment entirely.

A four step decision path that narrows a WooCommerce cart redirect down to the exact code responsible
Four observations, in order. Each one eliminates a whole category of cause.

Test safely on a live store

You do not need to take the store down to isolate this. The Health Check and Troubleshooting plugin has a mode that disables plugins and switches the theme for your logged-in session only. Customers keep seeing the normal site while you work. Start with only WooCommerce active, confirm the cart loads, then bring plugins back one at a time with the theme last.

My take: rebuilding the page is the wrong instinct

The most common paid fix for this problem is rebuilding the cart page, and it is usually wasted money. The redirect is attached to the address, not to the content of the page. You can rebuild that page five times and the request will still be intercepted before the content is ever rendered.

What takes people weeks is not difficulty. It is starting with changes instead of observations. Two response headers answer in one request what plugin-by-plugin deactivation takes two days to narrow down, and nobody teaches the header approach because listicles are easier to write.

If you take one thing from this: when something redirects, ask who sent it before you ask what to change.

How to fix this on your store

  1. Run curl with the head flag against your cart URL and confirm you are seeing a real 3xx.
  2. Read the X-Redirect-By header. If it names a plugin, you are done.
  3. Test in a private window with a throwaway query string, so neither the browser nor the cache fools you.
  4. If a code snippets plugin is installed, switch on its safe mode and retest.
  5. Add the mu-plugin trace file above and read X-Trace-Loaded, X-Trace-Redirect and X-Trace-Stack.
  6. If the trace file does not load at all, confirm the document root. You may be editing a different copy of the site.
  7. Use Health Check troubleshooting mode to isolate, plugins first and theme last.
  8. Delete the trace file when you are finished.

Where this stops being a self-service job is when the stack trace names core WordPress functions rather than a plugin. That usually means something is interfering with how the URL is matched to a page, and the fix depends on what else your store is doing.

Get the cause found in an hour, not a fortnight

If your cart or checkout is redirecting and you have already been through the obvious checks, a WooCommerce technical review traces it properly and tells you what else on the store is in the same state. If the store is currently losing orders, WordPress rescue is the faster option.

Related reading: what to check when WooCommerce checkout is not working, and checkout friction: technical problems that look like UX problems.

Frequently asked questions

Why does my WooCommerce cart page redirect to the homepage?

Because something in PHP is intercepting the request before the page renders. The usual sources are a custom snippet, a membership or language plugin, or a theme function hooked to template_redirect. Page assignment, permalinks and htaccess are worth checking but are rarely the cause when they look correct. Read the X-Redirect-By response header to find out which code sent it.

What is the X-Redirect-By header?

WordPress adds it to any redirect sent through its wp_redirect function, naming the caller. If it names a plugin, that plugin sent the redirect. If it just says WordPress, the caller did not identify itself but you still know the redirect came from PHP rather than from your server configuration or CDN.

Will rebuilding the cart page fix the redirect?

No. The redirect is triggered by the URL being requested, not by what the page contains, so the request is intercepted before your content is ever rendered. Rebuilding the page is a common paid fix for this problem and it almost never works. Find the code sending the redirect instead.

Why does the cart redirect but my account page works?

Because whatever is intercepting is matching on the cart address specifically. Membership plugins, language plugins and custom snippets commonly target cart and checkout while leaving other pages alone. The fact that other pages work is useful evidence: it rules out permalinks, your theme and general rewrite problems.

Working through a similar problem?

Share the context and the part that needs to work better. I can help define the next useful step.

Muzammil HussainUpwork / Top RatedMuzammil HussainWordPress & WooCommerce engineering.100%Job Success86Jobs2.6KHoursWork with me on UpworkProfile figures checked 2026-10-26. Opens in a new tab.

Written by Muzammil, independent WordPress and WooCommerce engineer. Explore the services or discuss your project.