Title: Merging Exported Field Data
Last modified: September 1, 2016

---

# Merging Exported Field Data

 *  Resolved [bt_dev](https://wordpress.org/support/users/biotrace/)
 * (@biotrace)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/)
 * Hi all – Is it possible to merge exported data from several fields into one column?
   Our accounting software will only access addresses in a particular format. Example:
 * Instead of
    [Shipping Address 1] [Shipping Address 2] [Shipping City] [Shipping
   Postcode] [Shipping Country]
 * Use this
    [Shipping Address 1] [Shipping Address 2, Shipping City, Shipping Postcode][
   Shipping Country]
 * So address 2, city and postcode are all in one column?
 * [https://wordpress.org/plugins/wp-all-export/](https://wordpress.org/plugins/wp-all-export/)

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7672968)
 * Hi biotrace,
 * Yes, this is possible. To do it you’d need to export the Order ID and then pass
   it through a function that gathers all of the required data and returns it in
   one string.
 * Here’s the function you’d use for your example:
 *     ```
       function pmxe_get_whole_address ( $id ) {
       	$custom_fields = get_post_custom( $id );
       	$shipping2 = $custom_fields["_shipping_address_2"][0];
       	$city = $custom_fields["_shipping_city"][0];
       	$postcode = $custom_fields["_shipping_postcode"][0];
       	return $shipping2 . ", " . $city . ", " . $postcode;
       }
       ```
   
 * Screenshot: [http://imgur.com/damGA5D](http://imgur.com/damGA5D)
 *  Thread Starter [bt_dev](https://wordpress.org/support/users/biotrace/)
 * (@biotrace)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7673030)
 * Excellent – That is fantastic. Again due to how our accounting software imports
   data, it also requires an empty row between each order. Is it possible to add
   row padding after each order entry?
 * Also, would this code reside in ../wp-includes/functions.php
 *  Thread Starter [bt_dev](https://wordpress.org/support/users/biotrace/)
 * (@biotrace)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7673043)
 * Please disregard the question about where code should be added. I saw your screenshot
   after 🙂
 * What function would I need to use for First and Last name? Is there a reference
   table of functions that I can refer to?
 *  Thread Starter [bt_dev](https://wordpress.org/support/users/biotrace/)
 * (@biotrace)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7673044)
 * Ahh, no edit button.
 * I have created some more functions based on your sample code and they are all
   working great.
 * The only question still remaining is if I can add a blank row after each order
   entry.
 *     ```
       <?php
       function pmxe_get_customer_name ( $id ) {
       	$custom_fields = get_post_custom( $id );
       	$first = $custom_fields["_shipping_first_name"][0];
       	$last = $custom_fields["_shipping_last_name"][0];
       	return $first . " " . $last;
       }
       ?>
   
       <?php
       function pmxe_get_whole_address ( $id ) {
       	$custom_fields = get_post_custom( $id );
       	$shipping2 = $custom_fields["_shipping_address_2"][0];
       	$shipping1 = $custom_fields["_shipping_address_1"][0];
       	return $shipping2 . " - " . $shipping1;
       }
       ?>
   
       <?php
       function pmxe_get_whole_address2 ( $id ) {
       	$custom_fields = get_post_custom( $id );
       	$city = $custom_fields["_shipping_city"][0];
       	$state = $custom_fields["_shipping_state"][0];
       	$postcode = $custom_fields["_shipping_postcode"][0];
       	return $city . " " . $state . " " . $postcode;
       }
       ?>
       ```
   
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7673102)
 * Hey biotrace.
 * You can create a blank row after each order entry with the following code:
 *     ```
       add_filter( 'wp_all_export_csv_rows', 'wpai_wp_all_export_csv_rows', 10, 3 );
       function wpai_wp_all_export_csv_rows( $articles, $options, $export_id ) {
       	$articles[] = "";
               return $articles;
       }
       ```
   

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

The topic ‘Merging Exported Field Data’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-export/assets/icon-256x256.png?rev=2570162)
 * [WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel](https://wordpress.org/plugins/wp-all-export/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-export/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-export/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-export/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-export/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-export/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/merging-exported-field-data/#post-7673102)
 * Status: resolved