Memberships has a native CSV import / export that will allow you to:
- import a CSV of your members to update or merge membership data
- import a CSV of members to create new memberships (and even create new user accounts if needed)
- export all members, or export members based on status, plan, start date, or expiration date
- export selected members to CSV using a bulk action
Before importing members, please read the “Grant Access” section first, as this may apply to you.
Note that the import / export methods outlined here will only apply to user memberships; they will not create or export subscription / recurring billing.
Importing can be seen as a bulk create / edit for members, while exporting can help you get member data for your email service or other services connected to your site.
Developers: You may also want to check out this community plugin to add CLI support for imports, which imports via command line for large data sets, and our REST API documentation, which lets you read user membership data.
Importing can be seen as a bulk create / edit for members, while exporting can help you get member data for your email service or other services connected to your site.
Exporting members
↑ Back to topmember_since
and membership_expiration
columns will show the member start and end dates (respectively) in the site’s selected timezone. You can import these members later, just be sure to select the site timezone for the import file as well.
If you would like to export in UTC time instead, you can add this small code snippet wherever you keep custom code to change the exported time:
add_filter( 'wc_memberships_csv_export_user_memberships_dates_in_utc', '__return_true' );To export members, go to WooCommerce > Memberships > Import / Export, and ensure you’re on the “Export to CSV” tab. Here you can configure export options to export all members or groups of members. Combinations of these settings can be used to get a customized list of members.
- Plan – Select plans if you’d like to export only members belonging to certain plans. Leave this blank to export members of any plan.
- Status – Select membership statuses if you’d like to export only members who have certain statuses (ie only “active” and “complimentary” members). Leave this blank to export members with any status.
- Start Date – You can optionally restrict the export based on the member’s start date. Add a range to export members who signed up during that date range; you can also leave ranges open ended, such as “From ___ to 2016-05-01”, which will give you any member who signed up before May 1, 2016. Leave this blank to ignore start date in the export.
- End Date – You can optionally restrict the export based on the member’s expiration date. Add a range to export memberships that expire during that date range; you can also leave ranges open ended, such as “From ___ to 2016-05-01”, which will give you any member whose membership expired before May 1, 2016. (This would also exclude open-ended / unlimited memberships!) Leave this blank to ignore expiration date in the export.
- Meta Data – Enable this to include all meta data for a membership, such as paused date, or data added by other plugins
- Separate fields by – Changes the CSV delimiter, and defaults to comma; only change this if you know what you’re doing.
Bulk exporting members
↑ Back to topTroubleshooting exports
↑ Back to top- If your CSV file isn’t generated, please double-check any export options you’ve set. You may be using option to limit the member list that do not correspond to any memberships on your site.
Import via grant access action
↑ Back to top- Do you already have existing orders for purchases of your membership product? Use “Grant access” — this will create new memberships and tie them to the order record the membership was purchased in.
- Do you already have existing subscriptions? If yes, do they include the product that grants access to the membership as a line item? If so, you can use “Grant Access” to create your memberships, as both orders and subscriptions assigned to users are checked.
Requirements for import
↑ Back to topDevelopers: You may also want to check out this community plugin to add CLI support for imports, which imports via command line.
In order to bulk create or update user memberships, you must already have the following:
- Membership Plans: You must already create your membership plans under WooCommerce > Memberships > Membership Plans. You may want to optionally create rules and other settings for your plan, but only the plan itself needs to exist to import.
- Membership Plan IDs or slugs: You want to note the ID (post ID) or the slug for each membership plan; this will be used within the import to designate which membership plan the user will be assigned to (users can be assigned to multiple plans if desired). If you do not know how to get user or post IDs from WordPress, we recommend this tutorial.
- User identifer: When updating existing user memberships, you will need a way to identify the user you want to modify. You can use the
user_membership_ID
to identify an existing user and their membership plan. If you includemembership_plan_ID
ormembership_plan_slug
, you can instead useuser_ID
,user_name
, ormember_email
to identify an existing member.
Formatting import CSVs
↑ Back to topImport: column names
↑ Back to topColumn name | Required? | Column Data |
---|---|---|
user_membership_id |
Maybe | The user membership ID can be used to identify existing user memberships, but should be left blank to create new memberships. |
user_id |
Maybe | The WordPress user ID for the member / customer. Can be used to identify existing user memberships if used with the membership_plan_id or membership_plan_slug . |
user_name |
Maybe | The WordPress username / login name for the member. Can be used to identify existing user memberships if used with the membership_plan_id or membership_plan_slug , if user_ID isn’t available. If creating users, this will be added to the user account. |
member_email |
Maybe | The email address for the member. Required when creating new users. Can be used to identify existing user memberships if used with the membership_plan_id or membership_plan_slug , if user_ID and user_name aren’t available. |
member_first_name |
No | The member’s first name; if creating users, this will be added to the user account. |
member_last_name |
No | The member’s surname; if creating users, this will be added to the user account. |
membership_plan_id |
Maybe | The ID of the membership plan for this membership (i.e., the ID for “Gold Membership” plan). Either this column (recommended) or membership_plan_slug is required for imports to process. |
membership_plan_slug |
Maybe | The slug of the membership plan for this membership (i.e., the slug for “Gold Membership” plan). Either this column or membership_plan_id (recommended) is required for imports to process. |
membership_status |
No | * The membership status for the membership — if empty, defaults to active |
subscription_id |
No | Include the subscription ID if this membership should be tied to the billing of an existing subscription record (requires Memberships 1.7+). |
member_since |
No | ** The date membership access should start / started — if creating new memberships, you can set a default start date to be used when this is blank. |
membership_expiration |
No | ** The date membership access expires; leave blank for unlimited memberships |
order_id |
No | The ID of the order in which the membership was purchased, if you’d like to link to an existing order. |
product_id |
No | The ID of the product used to purchase the membership. |
active – Active
complimentary – Complimentary
delayed – Delayed
paused – Paused
expired – Expired
cancelled – Cancelled
Membership Statuses Used with Subscriptions
pending – Pending Cancellation free_trial – Free Trial
** You will be able to select whether your dates and times are in UTC or in your site’s timezone while importing.
pending – Pending Cancellation free_trial – Free Trial
Importing members
↑ Back to top- Choose a file from your computer – Upload your properly-formatted CSV file of memberships here.
- Import Options
- Update existing records if a matching user membership is found – Enable this if you’d like to merge or update memberships from the uploaded CSV. If enabled, when the user membership ID column matches an existing membership, that membership will be updated with your uploaded data. When this setting is disabled, rows with matching user membership IDs are skipped.
- Allow membership transfer between users… (only shown if “Update existing records… is enabled) – If enabled, when a user membership is matched, but the user ID doesn’t match the current member, the membership will be transferred to the new user in the CSV. When disabled, rows that have mismatched user membership IDs / users will be skipped.
- Create new user memberships if a matching user membership ID isn’t found – If enabled, when an existing user membership can’t be located from the CSV data, a new one will be created. When disabled, rows with user memberships that can’t be matched will be skipped.
- Create a new user if no matching user is found – When enabled, if an imported row contains data that doesn’t match an existing user (user ID, username, and email are checked in order), then a new user is created and this membership is assigned to the new user. When disabled, rows without matching users are skipped.
- Send new account notification emails when creating new users during an import – When enabled, if a new user is created, they’ll be sent the default WooCommerce “New Account” email.
- Default Start Date – When “Create new user memberships…” is enabled, this field is shown. Select a default starting date for any memberships that are created via import; this default is used when the
member_since
column is blank. - Dates timezone – Select whether the
member_since
andmembership_expiration
dates in your file are in your site’s timezone or in UTC. The export default is the site timezone. - Fields are separated by – Select the delimiter for your CSV file. Defaults to comma — only change this if you know what you’re doing.
Troubleshooting imports
↑ Back to top- You see a “Could not find User Memberships to import from uploaded file.” error: This means your CSV is either missing required information, or is unreadable. Please check your CSV format to ensure the required information is present and all column headers are named exactly as they are in our table. If this is correct, please upload your CSV file to Google Sheets and re-download it, as its format is probably at fault.
- Your import dies in the middle of the process without importing all members: This most likely indicates that you’re importing a larger number of members than your server can handle. Please break your CSV file up and re-try the import, as you can import multiple times. First try breaking the import into half, then in half again, etc, until your import completes successfully. Typically you should be able to import a few thousand rows without issue, but this depends on your hosting environment.
Frequently asked questions
↑ Back to topQ: Can I add the customer’s data like the phone number to the export file? A: The export only currently includes data related to the user membership itself. If you wanted to add additional customer data to this export file, you would need the help of a developer to modify the export file. You could consider 2 options:
- Use the Customer / Order CSV Export as a starting point, and modify the customer export query to only include users with memberships (this would give you an export of members only with all customer data, but not membership-specific data, but this could be added).
- Modify the Memberships export file via custom code to add additional columns as needed to the member export. You can find ample filters in the
/includes/utilities/class-wc-memberships-csv-export-user-memberships.php
file to modify the export output as needed.
Questions & support
↑ Back to topAll done here? You can return to the main document / table of contents.