Title: Product Custom Permalink
Last modified: May 14, 2020

---

# Product Custom Permalink

 *  Resolved [aghdaeea](https://wordpress.org/support/users/aghdaeea/)
 * (@aghdaeea)
 * [6 years ago](https://wordpress.org/support/topic/product-custom-permalink/)
 * Hi,
 * I’m using custom permalink for my shop products:
 * [http://www.mydomain.com/stocks/%category%/%product-name%/](http://www.mydomain.com/stocks/%category%/%product-name%/)
 * I want to change the %product-name% with product-id so it never gonna change.
 * Could you help me do that?
 * Kind Regards

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [Stuart Duff – a11n](https://wordpress.org/support/users/stuartduff/)
 * (@stuartduff)
 * Automattic Happiness Engineer
 * [6 years ago](https://wordpress.org/support/topic/product-custom-permalink/#post-12839230)
 * Hi [@aghdaeea](https://wordpress.org/support/users/aghdaeea/),
 * > I want to change the %product-name% with product-id so it never gonna change.
 * This code is an example of how to set a custom URL structure and may work for
   you as a starting point.
 * [https://wordpress.stackexchange.com/a/324107](https://wordpress.stackexchange.com/a/324107)
 * You could also look at some of these types of plugins which may help with this
   too.
 * [https://wordpress.org/plugins/search/permalink/](https://wordpress.org/plugins/search/permalink/)
 *  [AJ a11n](https://wordpress.org/support/users/amandasjackson/)
 * (@amandasjackson)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/product-custom-permalink/#post-12876346)
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   if you have any further questions, you can start a new thread.
 *  Thread Starter [aghdaeea](https://wordpress.org/support/users/aghdaeea/)
 * (@aghdaeea)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/product-custom-permalink/#post-12876530)
 * Hi,
 * Thanks for your support, I got close to the answer but still have some problem
   with the code. And I wish you could help me out.
 *     ```
       function wpd_woo_product_permastruct(){
           add_permastruct(
               'product',
               '%product_cat%/%product%-%post_id%/',
               array(
                   'walk_dirs' => false,
                   'with_front' => false
               )
           );
       }
       add_action( 'init', 'wpd_woo_product_permastruct', 99 );
       ```
   
 * When I try to remove the “%product%” before “%post_id%” the link doesn’t work
   anymore, and I don’t know why! I just want to have post Id at the end of my products
   links.
 * Kind Regards,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Product Custom Permalink’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [aghdaeea](https://wordpress.org/support/users/aghdaeea/)
 * Last activity: [5 years, 12 months ago](https://wordpress.org/support/topic/product-custom-permalink/#post-12876530)
 * Status: resolved