WooCommerce Product Redirects To Different Product URL

WooCommerce Product Redirects To Different Product URL

The issue:

Clicking on a given product in the store brings the user to a different product instead, as if there is some kind of redirect happening that the admin never set.

Example: Clicking a product with the URL "/store/product5" instead goes to "/store/product7". In this case, "/product7/" is also a valid (but separate) product.

The solution:

There are variables in the WP database that store old URLs for pages, similar to a cache. Since it's not exactly cache, however, you'll find that clearing your WP cache doesn't help. You can reset this data by doing the following, a solution provided by "teiV" and "KrissLiss" on this page:

I went into the WordPress database. I did this by logging into my cPanel and navigating to the "phpMyAdmin" option.

I was taken to another screen where I saw that I had two databases. My databases where located in a panel on the top left hand side of the page. I selected my WordPress database (the one with "wp" in the name).

I was then presented with the WordPress tables. From there, I did a search for "_wp_old_slug" and was presented with a list of my old slugs. When you search, make sure you don't leave out the first underscore in "_wp_old_slug" because that makes a difference.

In the search results, I selected and deleted the files whose meta_values pertained to the slug in question.

After deletion, I tested the page in question and it's back to normal!

We tested this on a site having this very issue and can confirm it worked for us.

Leave a Comment

You must be logged in to post a comment.