Product Icon

WooCommerce Memberships

Power your membership association, online magazine, elearning sites, and more with access control to content/products and member discounts.

Add $export_args on the wc_memberships_csv_export_user_memberships_query_args filter

The filter wc_memberships_csv_export_user_memberships_query_args can’t have the $export_args variable :

“`
$query_args = (array) apply_filters( ‘wc_memberships_csv_export_user_memberships_query_args’, $query_args );
“`

My use case is to add a new option in the export form to get all active access membership members (add active, complimentary, free_trial, and pending in the $query_args[‘post_status’]).

Author

Michel ALABAU

Current Status

Open

Last updated: November 3, 2025

1 comment

Log in to comment on this feature request.

  1. Michel ALABAU says:

    And in the class-wc-memberships-ajax.php add a filter for allow to change the attrs given to the create_job :

    “`
    wp_send_json_success( (array) $export_handler->create_job( [
    ‘user_membership_ids’ => empty( $_POST[‘user_membership_ids’] ) ? $export_handler->get_user_memberships_ids_for_export( $export_args ) : array_map( ‘absint’, $_POST[‘user_membership_ids’] ),
    ‘include_profile_fields’ => isset( $export_args[‘include_profile_fields’] ) && ‘yes’ === $export_args[‘include_profile_fields’],
    ‘include_meta_data’ => isset( $export_args[‘include_meta’] ) && ‘yes’ === $export_args[‘include_meta’],
    ‘fields_delimiter’ => ! empty( $export_args[‘fields_delimiter’] ) ? sanitize_text_field($export_args[‘fields_delimiter’]) : ‘comma’,
    ‘date_format’ => ! empty( $export_args[‘date_format’] ) ? sanitize_text_field($export_args[‘date_format’]) : ”,
    ‘custom_date_format’ => ! empty( $export_args[‘custom_date_format’] ) ? sanitize_text_field($export_args[‘custom_date_format’]) : ”,
    ] ) );
    “`