The strange case of Woocommerce Csv Export plugin not working

WooCommerce is an WordPress plugin that lets you sell products and services from your website: it’s free but with additional features available as paid addons.

Among those available plugin is Woocommerce Csv Export that permit to export orders and other stuff from WooCommerce database to a CSV file easily, using ftp, mail or just create a file in a local folder.

These days I’ve moved a WordPress web-site, using WooCommerce + Woocommerce Csv Exportor, working properly for years in a new Debian-based LAMP hosting and…. it did not work anymore.Using the manual or automatic csv export the related create files are empty and the activity remain queued (export list queued indefinitely).

I’ve contacted the customer support and …… I did not get any effective help !

So I started investigating the code.

I’ve found that some parts are based on the project wp-background-processing by A5hleyRich, a really awesome PHP project can be used to “fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks” and ….just this is the unworkable part.

To obtain an asynchronous task the code call some WordPress parts in website itself and this is the crucial point of the problem: this calls does not work at all !

After some investigation I’ve verified that the edge-network firewall has problems with reflection. When the website call itself, using public Ip, this call not work…….

Att.: In my case WordPress is hosted in a Debian LAMP machine with a private IpAddress (192.168.1.1), and using a NAT 1:1 with an external IP address (1.2.3.4).

Att.: NAT Reflection (named also NAT loopback or hairpinning) basically means you can have one or more hosts inside a LAN using a port forward configured in the edge-firewall to be able to reach them using externl IPs; these host are able to access to itself or other hosts in the same LAN using public IPs. In my case the PHP code can call itself using 1.2.3.4 like IP, and not 127.0.0.1 or 192.158.1.1 or other similar loopback address.

Possible Solution
1) Modify the host file file that resolve the url in local ip address (in my case 192.168.1.1).
2) Enable the reflection in you edge firewall.
3) Throw away the firewall and replace it with someone more serious who can support reflection (i.e. pfSense)

Linkografia
WooCommerce offical website
Order/Customer CSV Export
GitHub: Wp-background-processing