1. Documentation /
  2. Groups WooCommerce /
  3. Shortcodes

Shortcodes

User Group Memberships

↑ Back to top
The [groups_woocommerce_memberships] shortcode renders group membership information for the current user. Each valid membership displays the group, for time-limited memberships, the date and time until the membership is valid is shown, too. You can put this shortcode on any page or also add it to the My Account page as in this example: Example output for a customer with membership information displayed through the shortcode: My Account showing customer memberships via shortcode Please note that membership info with the Registered group is not displayed, as this is a fixed group to which all users belong. If we view the membership information on the back end for this user (this can be enabled in the Settings), we will see: Showing various memberships The shortcode can be customized using the following attributes.

Attributes

↑ Back to top
  • exclude : A list of group names separated by comma. Membership information related to these groups is not shown. The Registered group is excluded by default.
  • show_count : Whether to render the number of valid memberships. Enabled by default, use “false” to disable.
  • count_0 : When showing the number of membership, the message to render for 0 valid memberships.
  • count_1 : The message to render for one valid membership.
  • count_n : The message shown for two or more valid memberships. The placeholder %d is used to display the number of valid memberships,

Example

↑ Back to top
To display the valid memberships for the current user omitting the count:

[groups_woocommerce_memberships show_count="false"]

User Subscription Group Memberships

↑ Back to top
The [groups_woocommerce_subscriptions_table] shortcode can be used to list a user’s subscriptions and related group memberships. To use this shortcode, the WooCommerce Subscriptions extension is required. It will not render any output if the extension is missing.

Attributes

↑ Back to top
  • status : Subscription status, defaults to active. Can be a comma-separated list containing any of active, on-hold, cancelled, trash, deleted. Use * for all subscriptions.
  • user_id : Defaults to the current user’s id, accepts user id, email or login.
  • show_count : If info about how many subscriptions are listed should be shown. Defaults to “true”.
  • count_0 : Message for 0 subscriptions listed.
  • count_1 : Message for 1 subscription listed.
  • count_2 : Message for n subscriptions listed, use %d as placeholder in a customized message.
  • show_table : If the table should be shown. Defaults to “true”.
  • columns : Which columns should be included. Defaults to all columns. Specify one or more of status, title, start_date, expiry_date, end_date, trial_expiry_date, groups or order_id.

Example

↑ Back to top
Display a list of all of the user’s subscriptions, showing the subscription title, start date, status and groups in that order:

[groups_woocommerce_subscriptions_table columns="title,start_date,status,groups" status="*"]