Title: Retrieve custom field value
Last modified: January 3, 2020

---

# Retrieve custom field value

 *  Resolved [Soraco Technologies](https://wordpress.org/support/users/soraco/)
 * (@soraco)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/)
 * Hi
 * I’m evaluating your Product Addons for Woocommerce.
    I’ve created a custom Text
   Field and it shows up as expected on my order page. I need to retrieve the value
   that the customer enter from my php code. I found an article in the forum that
   says to use the code below:
 * $skus = $item_quantities = $line_item_totals = $items_meta_data = array();
    //
   Loop though order items foreach( $order->get_items() as $item_id => $item){ $
   items_meta_data[] = $item->get_meta_data(); }
 * What I need is a way to retrieve the value the user entered in a Text Field. 
   Can you please help with that?
 * Thanks
    Ralph
    -  This topic was modified 6 years, 5 months ago by [Soraco Technologies](https://wordpress.org/support/users/soraco/).

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

 *  Plugin Author [acowebs](https://wordpress.org/support/users/acowebs/)
 * (@acowebs)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/#post-12319105)
 * Hi,
    You want to access the text field in cart once the user submit the form?
   or after completing the order?
 *  Plugin Author [acowebs](https://wordpress.org/support/users/acowebs/)
 * (@acowebs)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/#post-12319474)
 * Find an example code below on how to get field value
 *     ```
        $order = wc_get_order(242);
           foreach ($order->get_items() as $item_id => $item) {
               $meta_data = $item->get_meta(WCPA_ORDER_META_KEY);
               // $meta_data this $meta_data will have all the user submited data. You can iterate through this and get the required value
       // see below example code
               $dataRequired= '';
               foreach ($meta_data as $v){
                   if($v['name']=='number-1551176731967'){
                       $dataRequired = $v['value'];
                   }
               }
   
   
           }
       ```
   
 *  [ashin_acowebs](https://wordpress.org/support/users/ashinacowebs/)
 * (@ashinacowebs)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/#post-12356102)
 * As we haven’t heard back from you further, we assume that this issue has been
   resolved at your end and considering this ticket as closed. Please don’t hesitate
   to get back to us if you require any further assistance or clarifications from
   our end in the future. Thanks!
 *  [ahmedthahir](https://wordpress.org/support/users/ahmedthahir/)
 * (@ahmedthahir)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/#post-12719051)
 * WCPA_ORDER_META_KEY
    What mean by this What to add there?

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

The topic ‘Retrieve custom field value’ is closed to new replies.

 * ![](https://ps.w.org/woo-custom-product-addons/assets/icon-256x256.gif?rev=3328656)
 * [Product Addons for Woocommerce - Product Options with Custom Fields](https://wordpress.org/plugins/woo-custom-product-addons/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-custom-product-addons/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-custom-product-addons/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-custom-product-addons/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-custom-product-addons/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-custom-product-addons/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [ahmedthahir](https://wordpress.org/support/users/ahmedthahir/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/retrieve-custom-field-value-2/#post-12719051)
 * Status: resolved