Website Building » WooCommerce » How Do I Change the Permalinks of a Product in WooCommerce?

How Do I Change the Permalinks of a Product in WooCommerce?

Last updated on January 17, 2023 @ 3:12 pm

If you’re running a WooCommerce store, you’ll know that the permalinks for products are set to the default “Product” URL structure. This can be changed in the WordPress admin under Settings > Permalinks.

However, if you want to change the URL structure for just one product, you’ll need to use a plugin or custom code.

There are a few plugins that will allow you to change the permalink for a single product. One of these is the Permalink Manager plugin.

With this plugin, you can change the permalink for any post type, including products. To do this, go to the Permalink Manager settings page and click on the “Products” tab.

Then, find the product you want to change the permalink for and click on the “Edit” button. From here, you can change the URL slug for the product.

If you don’t want to use a plugin, you can also change the permalink for a single product with custom code.

First, you’ll need to add this code to your theme’s functions.php file:


function wc_product_permalink( $post_id )
{if ( 'product' == get_post_type( $post_id ) )
{$permalink = get_permalink( $post_id );return $permalink;}
return $post_id;}
add_filter( 'post_type_link', 'wc_product_permalink', 10, 2 );?>

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.