Woocommerce EXPORT CSV Plugin issue

by setjo
0 replies
  • WEB DESIGN
  • |
I recently added this plugin to export CSV files.

There are 3 ways to automatically export CSV i.e FTP, Email, HTTP POST

http://www.woothemes.com/products/or...paign=wcaddons

We want to export csv directly to the external url at:http://corp.egourmetsolutions.com:6051/clients/nativo/ under the folder "Orders Upload"The folder supports WebDAV but not FTP.

And this will be achieved thru HTTP POST option but our external url requires authentication. And to fix the issue I found this code listed in this url

WooCommerce Customer/Order CSV Export Developer Documentation | WooThemes Documentation


But My question is where to add this code


HTTP POST Filters

If you're using the automatic export over HTTP POST, there is a filter available to change the arguments used for wp_remote_post().

$args = apply_filters( 'wc_customer_order_csv_export_http_post_args', array(
'timeout' => 60,
'redirection' => 0,
'httpversion' => '1.0',
'sslverify' => false,
'blocking' => true,
'headers' => array(
'accept' => 'text/csv',
'content-type' => 'text/csv' ),
'body' => $csv,
'cookies' => array(),
'user-agent' => "WordPress " . $GLOBALS['wp_version'],
) );

For example, if the web service you're posting to requires authentication, you could use this filter to add HTTP basic auth to the headers:

<?php
function wc_csv_export_add_http_post_basic_auth( $args ) {

// you can set other HTTP headers using the format $args['headers']['Header Name'] = 'header value'
$args['headers']['Authorization'] = 'Basic ' . base64_encode( 'your_username:your_password' );

return $args;
}
add_filter( 'wc_customer_order_csv_export_http_post_args', 'wc_csv_export_add_http_post_basic_auth' );
#csv #export #issue #plugin #woocommerce

Trending Topics