WPAE – export selected items only
-
I continue to be impressed with the quality of the plugin, and more-so with the support Soffly offers it.
To document a solution they generated for me regarding my issue, I thought I would echo it here.
I am using the WP All Export to Google feed XML generator, and am doing it in product batches. There isn’t a built-in method to feed it a list of SKUs I want to dump, so I asked for their assistance on how to feed it a list.
For the record, here’s their (excellent) response, which I look forward to implementing:
>> Is there some PHP-fu I could use to add a filter against a list with WPAE?
Yes, you could use our wp_all_export_csv_rows hook for this: https://github.com/soflyy/wp-all-import-action-reference/blob/master/all-export/wp_all_export_csv_rows.php. Here’s an example snippet that you can modify to work with SKUs instead of Order IDs:
function my_export_csv_rows( $articles, $options, $export_id ) {
if ( $export_id == ’10’ ) {
$export_these = array( ‘123’, ‘345’, ‘567’, ‘789’, ‘748’, ‘753’ );foreach ( $articles as $key => $article ) {
if ( ! in_array( $article[‘Order ID’], $export_these ) ) {
unset( $articles[ $key ] );
}}
}
return $articles;
}
add_filter( ‘wp_all_export_csv_rows’, ‘my_export_csv_rows’, 10, 3 );Keep in mind that the record count displayed won’t change but the file that’s generated will be properly filtered.
Again, thanks again for the excellent product & support.
The topic ‘WPAE – export selected items only’ is closed to new replies.