Title: Hierarchy Slug
Last modified: January 29, 2021

---

# Hierarchy Slug

 *  Resolved [nmballa](https://wordpress.org/support/users/nmballa/)
 * (@nmballa)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/hierarchy-slug/)
 * Due to how we have to structure our filtering we have edited woocommerce to allow
   for hierarchy of attributes. This is working just fine but does result in us 
   having to create sub-attributes for each of our parent attributes which does 
   result in quite a few attributes that share common names. As we want them to 
   display with the correct name we are trying to use slugs to give them a unique
   way to identify. We can do this manually but it is quite a chore.
 * Currently when you add an attribute and you leave the slug field blank woo just
   takes the name and lower capitalizes and adds a – between each word. If I can
   find a function or at minimum where the slug is created by the name and modify
   the code so that it then insert the hierarchy that would be great. Example being,
   if I had a parent called X and I create a sub attribute name Y, leave the slug
   field empty and click add, woo would create a slug name x-y automatically.
 * If someone can point me towards where this code might be found in the woocommerce
   directory.

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

 *  [Nicola Mustone](https://wordpress.org/support/users/nicolamustone/)
 * (@nicolamustone)
 * Automattic Happiness Engineer
 * [5 years, 3 months ago](https://wordpress.org/support/topic/hierarchy-slug/#post-13973598)
 * Hello there,
    The code you are looking for is here: [https://github.com/woocommerce/woocommerce/blob/master/includes/wc-attribute-functions.php#L466](https://github.com/woocommerce/woocommerce/blob/master/includes/wc-attribute-functions.php#L466)
 *  Thread Starter [nmballa](https://wordpress.org/support/users/nmballa/)
 * (@nmballa)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/hierarchy-slug/#post-13977735)
 * Awesome. Thanks so much.
 *  Plugin Support [abwaita a11n](https://wordpress.org/support/users/abwaita/)
 * (@abwaita)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/hierarchy-slug/#post-13989695)
 * Glad to hear it – thanks for letting us know!
 * I’ll mark this thread as resolved now. If you have any further questions, I recommend
   creating a new thread.

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

The topic ‘Hierarchy Slug’ 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/)

## Tags

 * [attributes](https://wordpress.org/support/topic-tag/attributes/)
 * [slug](https://wordpress.org/support/topic-tag/slug/)

 * 3 replies
 * 3 participants
 * Last reply from: [abwaita a11n](https://wordpress.org/support/users/abwaita/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/hierarchy-slug/#post-13989695)
 * Status: resolved