WooCommerce order received URL missing /checkout/ prefix — getting 404 after every purchase
Hey everyone, hoping someone can help with a weird WooCommerce issue that's been driving me crazy.
The problem: Every time a customer completes an order on my site, they get redirected to: /order-received/23651/?key=wc_order_xxx
Instead of the correct URL which should be: /checkout/order-received/23651/?key=wc_order_xxx
The /checkout/ prefix is being stripped from the redirect URL, causing a 404 every time. The orders ARE going through successfully and appearing in WooCommerce, it's just the redirect after payment that's broken.
What we've tried:
- Flushing permalinks multiple times
- Purging SiteGround cache and excluding
/order-received/from caching - Saving WooCommerce Advanced settings to reset endpoints
- Adding a PHP redirect via WPCode using
template_redirecthook - Adding a
woocommerce_get_return_urlfilter to redirect to a custom thank you page - Adding a RewriteRule to
.htaccess - Contacted SiteGround support — they couldn't fix it
- Switching the checkout page from Elementor widget to
[woocommerce_checkout]shortcode - Creating a brand new checkout page with a fresh slug
- Deactivating suspicious plugins one by one
Setup:
- WordPress with Elementor
- WooCommerce
- SiteGround hosting (NGINX)
- Checkout page slug is
checkout - WooCommerce Order Received endpoint is set to
order-received(correct default) - The site was built from a template and nobody has ever successfully purchased from the store before so unsure when this started
What's weird: If you visit the full correct URL /checkout/order-received/xxx directly it works fine. Something is actively stripping /checkout/ from the redirect URL before it fires.
Any ideas what could cause this? Could it be NGINX rewriting the URL at server level? Something in the theme or a plugin overriding the return URL?