WooCommerce Memberships: Useful Functions To Know

WooCommerce Memberships: Useful Functions To Know

If you are are just starting to work with WooCommerce Memberships and are having to do various things programatically, here are some functions that are useful to know and will make your life and job a lot easier.

Retrieve User’s Memberships

Retrieve a list of memberships this particular user belongs to. This function will return an array of WC_Memberships_User_Membership objects or NULL if no memberships are found for the user.

Check If User Is An Active Member Of A Particular Membership Plan

Use wc_memberships_is_user_active_member() to quickly figure out if a user is an active member of any of your membership plans

Check If User Is A Member Of A Particular Membership Plan

This function is similar to the the previous one, but it doesn’t not take into consideration the “Active” status.

Published by

Yojance Rabelo

To me, WordPress is a system to which versatility and power come naturally. Over the last thirteen years of my life, I have seen WordPress evolve from a simple blogging platform into the leading CMS that powers more than 27% of the Internet. My experience is broad, ranging all the way from writing WordPress plugins to creating WordPress themes based on PSD files. I am a master of developing and deploying membership sites powered by WooCommerce, WooCommerce Memberships, and WooCommerce Subscriptions.