Additional menu

Get MemberPress today! Start getting paid for the content you create! Get MemberPress Now
  1. Home
  2. Knowledge Base
  3. General
  4. Migration
  5. Migrating or Importing MemberPress Data

Migrating or Importing MemberPress Data

Before reading this page, be sure to review our Migrating Overview page first!

While it will likely be much easier for you to simply create your MemberPress Memberships, Rules, and Coupons manually; you can use the Importer to import them as well.

Important note: Before you can import rules or coupons, you must first have created or imported your memberships.

Here's a breakdown of what each of these CSV files should look like: (note CSV files must be in UTF-8 encoding in order to work. You can use a program like Notepad ++ to convert the encoding.)

Memberships CSV Format

Please be extremely careful to follow the formatting listed below EXACTLY. Failing to do so EXACTLY will result in your file failing to import correctly.

Required Columns:

  • name — Name of the Membership. It can be any small string of text.
  • price — Price of the Membership. It can be any number in a decimal format without a currency symbol — for example, 5.99 …
  • period — Number of weeks, months or years. Can be any valid whole number if the period_type='months' or period_type='weeks' but anything else, this can only be 1.
  • period_type — This is the period type. Can be ‘weeks', ‘months', ‘years' or ‘lifetime'.

Optional Columns:

  • trial — Sets whether or not the Membership has a trial period. It can be 1 for true or 0 for false. Defaults to 0.
  • trial_days — Number of days the trial will last. Can be any whole number. Defaults to 0.
  • trial_amount — The amount that will be charged to start the trial. It can be any number in a decimal format without a currency symbol — for example, 5.99 …
  • group_id — The group_id (which should already exist in MemberPress) of the group that the Membership should belong to. Must be the ID of a valid MemberPress group. Defaults to 0 (which indicates no group).

Rules CSV Format

Please be extremely careful to follow the formatting listed below EXACTLY. Failing to do so EXACTLY will result in your file failing to import correctly. 

Rules must be imported first, then followed by Access Conditions (see below). Access conditions are used to define what Memberships or Users etc. have access through the rules.

Required Columns:

  • type — The type of the rule. Can be ‘single_post', ‘category', ‘tag', ‘all_posts', ‘single_page', ‘parent_page', ‘all_pages', ‘partial', ‘custom' or any number of custom post type rule types in the format ‘single_forum' / ‘all_forums' …
  • target — The text that goes along with the rule, for ‘single_*' it should be the ID of an existing post or page, for ‘all_*' or ‘partial' should be blank, for ‘category' or ‘tag' should be the text of the tag or category, for ‘custom' should be a request_uri or the regexp of a request_uri.

Optional Columns:

  • regexp — Only applicable if type=”custom” … if set to 1, it will interpret the target as a regular expression. If set to 0, the target will be interpreted as a normal string. Defaults to 0.
  • drip — Controls whether or not there's a drip for this rule. It can be 1 for true or 0 for false. Defaults to false.
  • drip_type — Drip type can either be ‘days', ‘weeks', ‘months' or ‘years'. Defaults to ‘days'.
  • drip_duration — The duration of the drip (number of days, weeks, months or years). It can be any whole number. Defaults to 0.
  • drip_trigger — The event that triggers the drip. Can be ‘registers', ‘fixed', ‘rule-products' or a valid Membership ID. Defaults to ‘registers'.
  • drip_after_date — If drip_trigger is set to ‘fixed', then this is required and must be set to a fixed date in the format of YYYY-MM-DD.
  • expire — Controls whether or not there's an expiration for this rule. It can be 1 for true or 0 for false. Defaults to false.
  • expire_type — Expire type can either be ‘days', ‘weeks', ‘months' or ‘years'.
  • expire_duration — The duration of the expiration (number of days, weeks, months or years). It can be any whole number. Defaults to 0.
  • expire_trigger — The event that triggers the expiration. Can be ‘registers', ‘fixed', ‘rule-products' or a valid Membership ID. Defaults to ‘registers'.
  • expire_after_date — If expire_trigger is set to ‘fixed', then this is required and must be set to a fixed date in the format of YYYY-MM-DD.

Access Conditions (See Rules) CSV Format

This applies to the second part of MemberPress -> Rules section, as shown in this screenshot:

Please be extremely careful to follow the formatting listed below EXACTLY. Failing to do so EXACTLY will result in your file failing to import correctly.

Rules (above) must exist before you can import Access Conditions.

Required Columns:

  • rule_id — The ID of the Rule these Access Conditions should apply to.
  • access_type — The type of access being imported. It can be ‘membership' or ‘member'.
  • access_condition — The value of the access_type above. So, for example, if ‘membership' is the access_type, then a Membership ID should be used here. Or, if ‘member' is the access_type, then the username or email address for the existing user should be used here.

Coupons CSV Format

Please be extremely careful to follow the formatting listed below EXACTLY. Failing to do so EXACTLY will result in your file failing to import correctly. 

Required Columns:

  • type — The discount type of the coupon. It can either be ‘dollar' or ‘percent'.
  • discount — The discount that will be charged to start the trial. It can be any number in a decimal format without a currency symbol or percent symbol — for example, 5.99 …
  • product_id_0 — An ID of a Membership that this coupon is for. Must be the ID of an already existing Membership in the database.

Optional Columns:

  • code — The coupon code. This defaults to a randomly generated coupon code.
  • usage_amount — Number of times the coupon can be used. It can be any valid, whole number. Defaults to 0 (which means unlimited).
  • use_on_upgrades — Determines whether a coupon can be used for upgrades/downgrades when memberships are in a group. Allowed values are 0 (can not be used for upgrades/downgrades) and 1 (can be used for upgrades/downgrades). Defaults to 0.
  • discount_mode — Can be “standard”, “trial-override”, or “first-payment”. If set to “first-payment”, then the discount will apply only to the first payment period of an automatically recurring subscription. Make sure to add the “first_payment_discount_amount” column as well, or the first-payment coupon will not be imported correctly. Defaults to “standard”.
  • trial_days — Only used if discount_mode is set to “trial-override” and only for auto-recurring membership payments only. Specify the number of trial days the user gets by using this coupon before their regular payments begin. Defaults to 0 (no trial override).
  • trial_amount — Only used if discount_mode is set to “trial-override” and for auto-recurring membership payments only. Specify the amount the user will pay for their trial override days (see above). Defaults to 0.00.
  • expires_at — The expiration date of the coupon. Must be in the format “d/m/y” or “d-m-y”. Defaults to null.
  • starts_on — The start date of the coupon. Must be in the format “d/m/y” or “d-m-y”. Defaults to null.
  • product_id_N —  The ‘N' references any whole number. Its value is an ID of a Membership that this coupon applies to. The first product_id_0 is a required field, but many “product_id” columns that are numbered can be present. You can use this to import a coupon that should be applicable to multiple memberships.
  • first_payment_discount_type — Only works if discount_mode is “first-payment”. This is similar to “type” above, it accepts ‘dollar' or ‘percent'.
  • first_payment_discount_amount — Only works if discount_mode is “first-payment”. This is similar to the “discount” above. It can be any number in a decimal format without a currency symbol or percent symbol — for example, 5.99 …

Uploading the File

To upload the file(s) that you have created, simply follow these steps:

  1. Go to the MemberPress Plugin > Import. Once there, select your file type (either Memberships, Rules, or Coupons) from the type of file to import the drop-down menu:
  2. Next, use the “Choose File” button to upload your file (you can only import one file at a time). 
  3. Finally, click the upload button.

Importer Messages

After you import your file, the importer will show you a couple of different lines and boxes to let you know how your import went. Below these are outlined.

X Rows Successfully Imported – Here, the importer will tell you how many rows (in place of X) were successfully imported.

X  Rows Failed to be Imported – Here, the importer will tell you how many rows (in place of X) failed to import.

X Total Rows Processed – Here, the importer will tell you how many total rows (in place of X) were processed.

Row Success Messages – In this box, you will see any success messages related to your most recent import. 

Row Errors: – In this box, you will see any errors related to any rows from your most recent import. The message should be detailed enough for you to be able to know what you need to fix, so your file works properly upon import. 

CSV for failed rows … copy these, fix and reimport: – Here, you will be given the exact rows that need to be fixed. Make a note of them to fix the rows with the errors.

Was this article helpful?

Related Articles

computer girl

Get MemberPress today!

Start getting paid for the content you create.