Shortcodes

WooCommerce Membership uses two types of shortcodes - content restriction shortcodes and membership information shortcodes.

 

Content Restriction Shortcodes

  • [woocommerce_members_only][/woocommerce_members_only] - displays content to members only, hides content from anyone else, accepts optional list of plan keys
  • [woocommerce_non_members_only][/woocommerce_non_members_only] - displays content to anyone else but members, accepts optional list of plan keys (i.e. members with those plans won't see that content)

Usage example:

[woocommerce_members_only keys="regular, premium"] ... visible to members with plans regular or premium ... [/woocommerce_members_only]

[woocommerce_non_members_only] ... visible to everyone but members ... [/woocommerce_non_members_only]

 

Membership Information Shortcodes

  • [woocommerce_members_content_list] - displays a list of posts/pages accessible to member that otherwise are restricted (does not include members-only content restricted via content restriction shortcodes)
  • [woocommerce_member_active_plans] - displays a list of active membership plans for current user
  • [woocommerce_member_active_plans_expire] - same as above but with an expiration date appended
  • [woocommerce_member_all_plans] - displays a list of all membership plans for current user (includes disabled plans)
  • [woocommerce_member_all_plans_expire] - same as above but with an expiration date appended
  • [woocommerce_member_active_plans_number] - displays a count of active membership plans for current user
  • [woocommerce_member_all_plans_number] - displays a list of all membership plans for current user (includes disabled plans)
  • [woocommerce_member_plan_expire_left] - displays how much time is left until a membership plan expires for current user, takes mandatory attribute plan to pass in membership plan key

 

Have more questions? Submit a request