Title: Exporting Input Fields Individually
Last modified: October 1, 2019

---

# Exporting Input Fields Individually

 *  Resolved [elinhart9](https://wordpress.org/support/users/elinhart9/)
 * (@elinhart9)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/)
 * Are there individual meta data keys for the input fields that can be used for
   export? I’m using Advanced Order Export for Woocommerce and I see that there 
   is an “Input Fields” export available, but that leaves all input values combined
   in one column. I see that you can export _alg_wc_pif_local and _alg_wc_pif_global
   but these exports include absolutely everything when I just need the value. I
   have tried custom meta keys of _alg_wc_pif_local_value and had no luck. Any help
   on this would be appreciated.
 * Thanks,
    Eric

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/exporting-input-fields-individually/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/exporting-input-fields-individually/page/2/?output_format=md)

 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-11996694)
 * hi Eric
 * if you use free version of “Input fields”plugin –
 * please, add field ” _alg_wc_pif_global” and put following code to section “Misc
   Settings”.
 * if you will add field _alg_wc_pif_local – adjust code too!
    thanks, Alex
 *     ```
       add_filter('woe_get_order_product_value__alg_wc_pif_global', function ($value,$order, $item, $product,$item_meta) {
        $t = unserialize($value);
        if( is_array($t) )
         $value = $t[0]['_value'];
        return $value;
       }, 10, 5);
       ```
   
    -  This reply was modified 6 years, 8 months ago by [algol.plus](https://wordpress.org/support/users/algolplus/).
 *  Thread Starter [elinhart9](https://wordpress.org/support/users/elinhart9/)
 * (@elinhart9)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-11999243)
 * Thank you for the prompt reply Alex! Worked Perfectly!
 * Eric
 *  Thread Starter [elinhart9](https://wordpress.org/support/users/elinhart9/)
 * (@elinhart9)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-11999264)
 * For anyone else wondering “Misc Settings” can be found on the Export Orders Tab
   of Woocommerce after downloading Advanced Order Export. Click the Custom PHP 
   Code box in order to add the filter code.
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-11999820)
 * you’re welcome 😉
    I’m an author of “Advanced Order Export for Woocommerce” plugin
 *  Plugin Support [kenil802](https://wordpress.org/support/users/kenil802/)
 * (@kenil802)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12008466)
 * Hi [@elinhart9](https://wordpress.org/support/users/elinhart9/),
 * I am glad that you found a fix for the issue and it is working fine on your site
   now.
 * Please let us know if you have any further queries regarding our plugin.
 * Regards,
    Kenil Shah
 *  Thread Starter [elinhart9](https://wordpress.org/support/users/elinhart9/)
 * (@elinhart9)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12043545)
 * So I decided to purchase the full version of the Plug-in and now have 3 Global
   inputs. Is there a modification to the code that would allow me to have these
   three Globals in difference columns now?
 * Thanks,
    Eric
 *  [anbaban](https://wordpress.org/support/users/anbaban/)
 * (@anbaban)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12512862)
 * This works incase we have just one field to export. But What if here is 4 fields
   to export
    “alg_wc_pif_global_1” “alg_wc_pif_global_2” “alg_wc_pif_global_3” “
   alg_wc_pif_global_4” ?
 * at the moment the code exports just [0]value which is 1st value
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12513200)
 * Do you want to export each value as separate column ?
    Or will we put 4 values
   in one cell ?
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12514810)
 *     ```
       // add this code to functions.php or via https://wordpress.org/plugins/code-snippets/
       // visit  >Setup Fields>Products to see these fields , and drag necessary fields to export 
       add_filter('woe_get_order_product_fields', function ($fields) {
       	// you must edit label and colname!
       	$fields['alg_1'] = array( 'label' => 'Age', 'colname' => 'Age', 'checked' => 1 );
       	$fields['alg_2'] = array( 'label' => 'Gender', 'colname' => 'Gender', 'checked' => 1 );
       	$fields['alg_3'] = array( 'label' => 'Prefer color', 'colname' => 'Prefer color', 'checked' => 1 );
       	$fields['alg_4'] = array( 'label' => 'Date of visit', 'colname' => 'Date of visit', 'checked' => 1 );
       	return $fields;
       });
       add_filter( 'woe_fetch_order_product', function ($row, $order, $item, $product, $item_meta ){
       	$scope  = "global";  // or local ?
       	$alg_meta = $item->get_meta( '_' . ALG_WC_PIF_ID . '_' . $scope );
       	foreach($row as $k=>$v) {
       		if(	preg_match('#alg_(\d+)#',$k,$m) ) {
       			$idx = $m[1] -1;
       			if( isset($alg_meta[$idx])) // has value?
       				$row[$k] = $alg_meta[$idx]['_value'];
       		}
       	}
       	return $row;
       },10,5);
       ```
   
 *  [anbaban](https://wordpress.org/support/users/anbaban/)
 * (@anbaban)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12514939)
 * Ok 1st I want to thank you for your effort.
 * How ever it is not working for me, maybe I do something wrong (I am not a PHP
   guru) although this is what I did:
 * 1. I placed the above code into “functions.php”
    2. you wrote: // visit >Setup
   Fields>Products to see these fields , and drag necessary fields to export Maybe
   you wanted to mention : // visit >Setup Fields>Product Items
 * Becasue in Prducts I dont see “alg_wc_pif_global”
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12514959)
 * If you’ve modified my code – you should see your “labels”
 * Here is my fields [https://imgur.com/gf3iVlM](https://imgur.com/gf3iVlM)
 *  [anbaban](https://wordpress.org/support/users/anbaban/)
 * (@anbaban)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12515012)
 * Yeah, I dint see those fields there. I thought I must Add them from the option
   add field.
 * Now it works for 100%! Your are my hero!
 * And this means I can add unlimited fields, just make the modifications in your
   function.
 * Thanks for help!
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12515287)
 * [@anbaban](https://wordpress.org/support/users/anbaban/)
    you’re welcome
 *  [eyeink](https://wordpress.org/support/users/eyeink/)
 * (@eyeink)
 * [6 years ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12819418)
 * [@algolplus](https://wordpress.org/support/users/algolplus/)
 * I am using the “Print Invoice & Delivery Notes for WooCommerce” and the “Product
   Input Fields for WooCommerce”. I am trying to get the data from my one input 
   field to show on my printed invoice.
 * Looking at the data I want it is stored in the DB
 *     ```
       woocommerce_order_itemmeta -> _alg_wc_pif_local ->
   
       a:1:{i:0;a:33:{s:7:"enabled";s:3:"yes";s:4:"type";s:8:"textarea";s:8:"required";s:2:"no";s:5:"title";s:25:"Special notes or comments";s:11:"placeholder";s:21:"Type your notes here.";s:13:"default_value";s:0:"";s:5:"class";s:0:"";s:5:"style";s:0:"";s:16:"required_message";s:28:"Field "%title%" is required!";s:22:"input_restrictions_min";s:0:"";s:22:"input_restrictions_max";s:0:"";s:23:"input_restrictions_step";s:0:"";s:28:"input_restrictions_maxlength";s:0:"";s:26:"input_restrictions_pattern";s:0:"";s:17:"type_checkbox_yes";s:3:"Yes";s:16:"type_checkbox_no";s:2:"No";s:16:"type_file_accept";s:15:".jpg,.jpeg,.png";s:24:"type_file_wrong_type_msg";s:16:"Wrong file type!";s:18:"type_file_max_size";s:1:"0";s:22:"type_file_max_size_msg";s:16:"File is too big!";s:22:"type_datepicker_format";s:0:"";s:23:"type_datepicker_mindate";s:4:"-365";s:23:"type_datepicker_maxdate";s:3:"365";s:23:"type_datepicker_addyear";s:2:"no";s:25:"type_datepicker_yearrange";s:9:"c-10:c+10";s:24:"type_datepicker_firstday";s:1:"0";s:22:"type_timepicker_format";s:7:"hh:mm p";s:24:"type_timepicker_interval";s:2:"15";s:23:"type_color_allow_typing";s:0:"";s:19:"type_select_options";s:0:"";s:15:"_plugin_version";s:5:"1.2.6";s:9:"_field_nr";i:1;s:6:"_value";s:19:"Happy Birthday Oma!";}}
       ```
   
 * The data from the customer’s input that I want to show in my product info is “
   Happy Birthday Oma!”
 * I had added some other data to my printout by using this code, but it did not
   work for this custom input field. Here is the code i tried in functions.php:
 *     ```
           if( get_post_meta( $order->id, '_alg_wc_pif_global', true ) ) {
               $new_fields['_alg_wc_pif_global'] = array( 
                   'label' => 'Special Customer Note',
                   'value' => get_post_meta( $order->id, '_alg_wc_pif_global', true )
               );
           }
       ```
   
 * Please let me know the correct code to get the data from your input fields plugin.
    -  This reply was modified 6 years ago by [eyeink](https://wordpress.org/support/users/eyeink/).
      Reason: code styling
 *  [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years ago](https://wordpress.org/support/topic/exporting-input-fields-individually/#post-12819627)
 * hi [@eyeink](https://wordpress.org/support/users/eyeink/)
    you’ve contacted to
   wrong person.
 * please, submit new ticket and ask [@kenil802](https://wordpress.org/support/users/kenil802/)
   to help you

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/exporting-input-fields-individually/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/exporting-input-fields-individually/page/2/?output_format=md)

The topic ‘Exporting Input Fields Individually’ is closed to new replies.

 * ![](https://ps.w.org/product-input-fields-for-woocommerce/assets/icon-256x256.
   png?rev=2717446)
 * [Product Input Fields for WooCommerce](https://wordpress.org/plugins/product-input-fields-for-woocommerce/)
 * [Support Threads](https://wordpress.org/support/plugin/product-input-fields-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/product-input-fields-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/product-input-fields-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/product-input-fields-for-woocommerce/reviews/)

 * 16 replies
 * 5 participants
 * Last reply from: [eyeink](https://wordpress.org/support/users/eyeink/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/exporting-input-fields-individually/page/2/#post-12820270)
 * Status: resolved