Question

I'm using "Woocommerce CSV Export" plugin and i've just added 2 custom fileds into my WC checkout page, I was wondering if i can add those fileds to the export plugin.

Était-ce utile?

La solution

Just add the following code into your "woocommerce-export-csv.php"

add_filter( 'woocommerce_export_csv_extra_columns', 'sites_add_custom_meta', 10);

and the define your function

function sites_add_custom_meta() {
  $custom_meta_fields['columns'][] = 'IP Address';
  $custom_meta_fields['data'][] = '_customer_ip_address';
  return $custom_meta_fields;
}

In this function you have two things you need to define. First, in the columns array you need to define the titles of your custom meta fields and then in the data array you need to define actual meta field name where the data for that field is located at. You need to have the same order in both arrays to be able to have correct information output under right column title.

Source : http://docs.woothemes.com/document/ordercustomer-csv-exporter/#section-4

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top