It’s been a busy 2-weeks at SkyVerge as we rolled out a compatibility update for all our extensions to make sure they support the new WooCommerce 2.6. This type of release usually packs no features, perhaps just minor tweaks or bugfixes at most, since we need to focus on compatibility with the newest WooCommerce version. This also helps us ensure nothing breaks in installations using an older version (we normally support the latest three versions of WooCommerce), ensuring a seamless upgrade.
There were a couple of exceptions though in this release cycle: Memberships packs a lot more along with WooCommerce 2.6 compatibility!
A CSV import and export feature for user memberships has landed 🙂 This was one of the most-requested features, making its way in the 2nd page of the most popular Woo Ideas. There are many other improvements too: bugfixes, performance tweaks, but most importantly some inner changes that will make development easier and faster in the next releases, and pave the way for more features and tweaks we will be adding to upcoming version 1.7.
In particular, our integrations with popular extensions often used in combination with Memberships, mainly Subscriptions, have been overhauled; discounts handling has been improved too, which would allow for a better integration with discounts or price-affecting extensions, like Dynamic Pricing, Product Bundles, Composite Products and more. Many of these improvements have been made possible thanks to the invaluable feedback our customers gave us through our contact form or support provided through WooCommerce Ninjas.
So, please, continue getting in touch with us and together we will continue delivering the finest e-commerce products and solutions for your business!
So, let’s get down to business and explore what’s shipping in the new feature. Let’s begin with exporting members. There are many reasons why you’d want to export your members. Say you want to sync your members list with a third party service, a mailing list, an internal system of yours — a convenient format to move data across systems and programs is through CSV (comma separated value) format.
This is a very portable and simple way of storing data that can be parsed and processed by many applications. It’s very convenient for humans to read as well, since it can be opened, viewed and edited in virtually any spreadsheet desktop program or web app.
When you export members from a Memberships installation, you will get a CSV file with the Memberships you decided to export. You can filter Memberships to include in a export file in different ways.
The simplest is just heading over Members screen and using a standard WordPress bulk action: select the User Memberships you want to export and click “Apply”. A file will be downloaded from your browser containing the user memberships you’ve just selected.
This export method doesn’t pack many options, you can just tick the members you want to export and that’s about it, but it’s the quickest way to obtain an export file.
What if you have a large members database or you need to fine tune your export conditions? We have a brand new dedicated admin screen for that! Head over the “Import / Export” tab in WooCommerce Memberships admin screens and you’ll be presented with many export filtering options! I hope you will find these to be as intuitive and complete as possible.
With “Plan” you can restrict export to one or more specific plans (leaving this blank will export members with any plan). “Status” will restrict the export to members with specific statuses (leaving blank will export user memberships of any status).
With the dates settings you can enter dates when user memberships have started or are supposed to expire. You can enter ranges or only one portion of a range to have open ended ranges.
For example, if you specify both ends (“from” and “to”) in the “Start Date” fields you will be exporting memberships who have been created between those two dates. If you enter only a date for “to” field in “Start Date”, the export will consider memberships that have been created up to the specified date regardless of when they have begun. If you specify a date only for the “from” field, it will consider memberships that have been created from a specific date onward.
“End Date” works in a similar fashion by looking at memberships expiration dates instead. You can combine the two range sets and as more dates you enter, the more you will be narrowing down memberships to export.
The rest of the settings you see in this screen are mostly intended for more advanced scenarios. With “Meta data” you can export every single user membership post meta data in a single cell in JSON format. This might be helpful to developers and in future we might consider to use this field in imports to restore third party meta data on a user membership.
You can choose to switch from comma to tab space as the CSV default separator by using the “Separate fields by” option. While “Limit Records” and “Offset Records” can be useful in remarkably large databases on less performing servers to avoid timeouts, or if you need to download a specific portion of a memberships export batch.
We have plans for the next iterations of the CSV feature to add the ability to process exports and imports in background, to make these features even more scalable. We’ve already begun to implement this in the newly released Customer / Order CSV Import rewrite.
So, what a CSV exported memberships will look like? We have a sample export file here, imported straight into Google Spreadsheets. If you want to read more about the CSV export feature, please head over the documentation on WooCommerce. Last but not the least, the CSV export process is very open to customization too thanks to several WordPress hooks for developers and power users alike.
Let’s now get over importing members into WooCommerce Memberships. Unlike export feature we can only import members from the specifically designed Import screen inside the “Import / Export” tab. This screen is similar to the one for exporting members and comes with many options as well to tune your import process.
Before we dig into the options you are presented here, let’s begin with an important foreword about what’s best to do before importing memberships into your site. While exporting memberships is a very straight-forward and forgiving task (if you forgot to tweak a setting in your export process, simply export a new file again), importing requires a bit more attention.
By importing memberships, you are going to add or alter data into your WordPress database. Mistakes can be reverted but they may require manual operations (unless you’re savvy enough to run some MySQL query to amend changes in bulk). Therefore it’s always a good idea, before adding or modifying data in bulk to a database, to backup the same database first.
Many hosts offer one-click backups or staging areas where you can test the changes before deploying those changes to your live site. For developers and power-users, you can also test these changes locally first.
The import feature will accept CSV files (either comma or tab separated – for the latter you need to choose the corresponding option in “Fields are separated by”). That’s not the only requirement, though. The data in the CSV file needs to be formatted in a way that Memberships can understand. Our standard import format matches the one that is delivered in a export file, so there have to be the same columns with the same names and similar values.You can use this sample import file from a Google Spreadsheet for guidance.
You don’t need to have all columns, as only few are necessary to create or update memberships. If you are creating a new membership, you don’t need to specify an existing User Membership ID under the
user_membership_id column for example, but you’ll need to specify at least a plan that the membership is for.
Memberships will look either for a
membership_plan_slug to match an existing Membership Plan in your installation. And you will need to specify a user for that membership, either by
user_id or by
member_email. Instead, to update a User Membership a
user_membership_id column with a valid id is necessary to match an existing membership in your installation; all the other fields present will be considered to update the membership. See the “Minimums for Import” sheet in our example.
You’ll notice that there are a few options to tune the behavior of an import process. For example, if you can allow or disallow creating new memberships or allow or disallow updating existing ones.
- If you are creating new memberships, what if you have no specified user id in your rows? You might want to create new users using an email address (hence the
member_emailfield is required in this scenario).
- What if you are allowing to update user memberships but the users do not match (the user membership in your database is linked to another user)? You can choose to have such memberships transferred.
- Finally, if your import file does not specify a start date, the import process will use the current date as the start date, however you can arbitrarily set a different date using the “Default Start Date” setting for these occurrences.
In future iterations of the CSV import feature we plan to add more verbose results output to let you understand what has changed in your existing memberships in case you need to do some manual review or tuning later. We also have plans to include a column field picker to help you conform any CSV file into columns that Memberships import can understand, as well as implement a background import process as mentioned for the export feature.
We recommend that you’d give a read to our documentation for the import feature and do not hesitate to ask us questions or reach support if you have any doubts on how to use this feature or how to prepare your import files!
The other changes this release of WooCommerce Memberships packs with are mostly internal but these will have an impact on your Memberships site. Some of the most obvious ones will be hiding a “View” link pointing to the Member Area for expired memberships; or fixing a bug where if you had enabled to discount the sign up fee for a Subscription product with membership discounts the totals were not right (this fix was also brought by our ever lasting relationship with our good friends at Prospress, the authors of Subscriptions).
In line with some changes that have started with previous releases since 1.5 onward, we are also paving the way to better handle synchronization between subscriptions and memberships: when a subscription is cancelled or deleted is now unlinked from the membership, providing better support for “re-purchasing”. Likely in 1.7 we will add more controls to link and unlink manually user memberships from subscriptions.
Another set of changes include how discounts are handled. This won’t change your current setup or behavior of the membership discounts. There have been reports of duplicated discounts or wrong discounts being applied when Memberships was used with other extensions that discounted or changed prices. We have fixed these, paving the way for better integration between new and existing third party extensions in the future.
If you are a developer and have customized or extended Memberships in your site or client sites you might want to review the changes that have been introduced with Memberships 1.6 as many of our internal classes have been refactored and some methods or properties have been deprecated. We accounted for fallbacks to avoid PHP errors, but you should update your code as well if you made any direct calls to any of these, as at some point we will remove the deprecated methods and properties to clean up the codebase.
So what’s cooking next? For upcoming version 1.7 we plan to add memberships expiration emails, another popular request on Woo Ideas. We have a long to do list that includes more tweaks with our Subscriptions integration, as well as other minor changes. We aim also to start bringing more unit testing in our products line and memberships could clearly benefit from that.
WP CLI support
One last thing, there was a feature that was completed for 1.6 but we decided to postpone to 1.7 as we wanted more time to test it out and perhaps our developer friends and users can chime in for feedback. Memberships will support WP CLI to manage user memberships.
WP CLI is a powerful tool to manage WordPress installations from the command line, aimed at developers and power users. This feature was created while testing the CSV Import / Export feature as a development aid to quickly make changes to user memberships but we reckon it can be a very purposeful in the hands of any WooCommerce developers, freelancers and agencies alike, who work on clients sites or power users who manage their WordPress installation from the terminal.
If you want to try it out and give us some feedback feel free to contact us!