Title: Attribute Top Level List to Array?
Last modified: August 21, 2016

---

# Attribute Top Level List to Array?

 *  [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * (@adeptris)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/attribute-top-level-list-to-array/)
 * Hi,
    I am working on a [free plugin](http://digitalraindrops.net/2013/07/wordpress-woocommerce-and-ipad-sales-presenter/)
   to export WooCommerce data for an off-line Ipad sales application.
 * I am new to the WooCommerce Codex, I know that the terms are stored with a key
   of pa_color and the post meta attributes for the attribute ‘color’ are stored
   with a key value attribute_pa_color
 * The attribute term ‘color’ is not stored in the core terms tables but in a table
   called wp_woocommerce_attribute_taxonomies
 * How in code can I get an array with the attribute_name and attribute_label from
   this table?
 * Once I have these the normal term code calls will work.
 * If I can return the values into an array variable $attribs then I can get the
   values (pa_color).
 *     ```
       foreach ( $attribs as $attrib ) {
         $terms = get_terms( 'pa_' .$attrib->attribute_name,
       	array(
       		'parent'    => 0,
       		'hide_empty' => 1
       	)
         );
         //Do stuff here
       }
       ```
   
 * I have tried this code but it does not return anything!
 *     ```
       global $wpdb,$table_prefix;
       $post_sql = "select * from $wpdb->woocommerce_attribute_taxonomies";
       $attribs = $wpdb->get_results($post_sql);
       ```
   
 * Please Help!
 * David
 * [http://wordpress.org/extend/plugins/woocommerce/](http://wordpress.org/extend/plugins/woocommerce/)

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

 *  Thread Starter [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * (@adeptris)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/attribute-top-level-list-to-array/#post-3941344)
 * Hi,
    Can anyone answer my Question or point me in the right direction?
 * I am quite far into creating the plugin, but I do need a solution to return the
   top level attributes to an array!
 * Here is the plugin in action, it will allow you to sell off-line:
    [http://www.youtube.com/watch?v=z7WqgjP-IiU&feature=youtu.be](http://www.youtube.com/watch?v=z7WqgjP-IiU&feature=youtu.be)
 * Regards
 * David
 *  [GregyPooh](https://wordpress.org/support/users/gregypooh/)
 * (@gregypooh)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/attribute-top-level-list-to-array/#post-3941454)
 * Hey David,
 * Did you find the solution?
 * If so, fill me in!
 * And did you finish your app?
 * Thanks David!

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

The topic ‘Attribute Top Level List to Array?’ 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

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

 * 2 replies
 * 2 participants
 * Last reply from: [GregyPooh](https://wordpress.org/support/users/gregypooh/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/attribute-top-level-list-to-array/#post-3941454)
 * Status: not resolved