Title: get attribute terms
Last modified: August 11, 2023

---

# get attribute terms

 *  Resolved [imanpak](https://wordpress.org/support/users/imanpak/)
 * (@imanpak)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/get-attribute-terms/)
 * Hello,
 * I want to get a list of product attribute terms.
 *  I want to know if there is a function similar to the get_the_term_list function
   that returns attribute terms instead.
 * If not, what is the best way to get it?

Viewing 1 replies (of 1 total)

 *  Plugin Support [Shameem – a11n](https://wordpress.org/support/users/shameemreza/)
 * (@shameemreza)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/get-attribute-terms/#post-16976453)
 * Hi [@imanpak](https://wordpress.org/support/users/imanpak/)
 * WooCommerce doesn’t have a direct function like get_the_term_list for attribute
   terms. However, you can achieve this by using a combination of WordPress and 
   WooCommerce functions.
 * Here’s an example on how to do it:
 *     ```wp-block-code
       $product_id = 123;
       $taxonomy = 'pa_color';
   
       $terms = get_the_terms( $product_id, $taxonomy );
   
       if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
       $term_list = array();
   
       foreach ( $terms as $term ) {
       $term_list[] = $term->name;
       }
   
       echo implode( ', ', $term_list );
       }
       ```
   
 * This should give you a list of attribute terms for a specific product. If you
   want to get a list of all terms for a specific attribute across all products,
   you might need to do a more complex database query.
 * Please note that [custom coding](https://woocommerce.com/support-policy/) is 
   not something we can assist with directly. However, I’ll keep this thread open
   for a bit to see if anyone from the community can lend a hand.
 * If you have any further questions on development or custom coding, don’t hesitate
   to reach out to some of our great resources available for support. Our WooCommerce
   community is brimming with skilled open-source developers who are active on the
   following channels:
    - [WooCommerce Developer Resources Portal](https://developer.woocommerce.com/)
    - [WooCommerce Advanced Facebook group](https://www.facebook.com/groups/advanced.woocommerce/)
    - [WooCommerce Developer Slack Channel](https://woocommerce.com/community-slack/)
    - Hire a [WooCommerce Expert](https://woocommerce.com/experts/)
 * I hope this helps! If you have any other questions, feel free to ask.
 * Thanks!

Viewing 1 replies (of 1 total)

The topic ‘get attribute terms’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shameem – a11n](https://wordpress.org/support/users/shameemreza/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/get-attribute-terms/#post-16976453)
 * Status: resolved