humanmade / S3-Uploads

The WordPress Plugin to Store Uploads on Amazon S3
1.94k stars 389 forks source link

Compatibility issue with WooCommerce Exports #610

Closed jay-oswald closed 1 year ago

jay-oswald commented 1 year ago

There appears to be a compatibility issue with S3-Uploads and WooCommerce Exports, by pressing the export button on the product list page.

If S3-Uploads is active then the exported file does not contain any products, just the header row, however when I remove S3-Uploads the export works as expected with products.

We have had this same issue on a few separate sites, I have tried using the upload_dir filter to set the uploads basedir (what the exporter uses) to a location outside of uploads when the exporter is running however it still has the same issue.

jay-oswald commented 1 year ago

550

606

Looks like its to do with this, and it can't be supported due to WC, but leaving this here since there's no other references directly to the WC export issue

amirHizkiya commented 1 year ago

Just in case anyone comes looking for a solution. I looks like @mhodge's solution in #550 was accepted and the filter woocommerce_csv_exporter_fopen_mode was added.

I was able to solve this for reports using the following code:

function woocommerce_csv_exporter_fopen_mode_filter( $fopen_mode ){
    $fopen_mode = 'a';
    return $fopen_mode;
}
add_filter( 'woocommerce_csv_exporter_fopen_mode', 'woocommerce_csv_exporter_fopen_mode_filter' );