WooCommerce: Change Product Permalinks @ Shop / Loop Pages

A BloomerArmada fan asked me a very interesting question: how can I link each product in the shop page to its own custom landing page as opposed to the default permalink?

Of course this applies when you don’t want to use the default single product page for all or some products. Clearly, you could set up a 301 redirect from the single product page to the landing page – that will help for SEO as well. But if this is temporary, or you need to still give access to the single product page later on, then a redirect is no good.

So, here’s how you can override the default permalink.

Linking a product to a custom landing page URL instead of the default WooCommerce single product permalink

Snippet (PHP): Change Product Links @ WooCommerce Shop / Loop Pages

Thankfully, the woocommerce_template_loop_product_link_open() function, which is responsible for the product “a href” in the loop pages, contains a filter:

You can therefore change that link with add_filter() and return your custom URL instead of the default permalink.

It even gives you access to $product, which means if you have the custom URL saved in a custom field, you can return that programmatically.