- To restrict coupons by role, no specific requirements need to be met.
- To restrict coupons by group, the free Groups membership plugin is required.
- To automatically assign users to groups based on product purchases, the WooCommerce Groups extension is recommended, but it is not a requirement for this extension’s features to be fully supported.
If you have not already installed the free Groups membership plugin, we recommend to install and activate it, as it allows to use the advanced coupon settings related to group memberships.A new menu item WooCommerce > Group Coupons gives access to several options that can be adjusted:
- Automatic group coupons – Enables options to apply coupons automatically based on group memberships with the free Groups membership plugin.
- Coupon error message – Allows to customize the notice shown when a customer tries to apply a coupon code which is restricted to a group to which the user does not belong.
- Roles – Enables coupon restriction options by WordPress user role.
- Logout – This provides an option to completely remove any coupons applied to a cart after a user logs out.
- A new subsection related to Groups
- A second subsection for Roles
Groups – limit the coupon to group membersOnly members of the selected groups will be allowed to use the coupon. If no group is selected, the coupon is not restricted to any group members.
Automatic application – apply the coupon to group members automaticallyThe coupon will be applied automatically to members of any of the selected groups. It’s important to note that this does not limit the coupon to group members, anyone could use the coupon – it will just not be applied to anyone automatically. If the coupon should only be available to members of the selected groups, you must also limit the coupon to these groups.
Exclude Groups – exclude group members from using this couponMembers of the groups chosen here will not be allowed to use the coupon. The Roles subsection of the settings under Coupon data allows to limit the coupon to certain roles. You can access this section when you add a new coupon or edit an existing coupon.
Roles – limit the coupon to rolesOnly users who have one of the selected roles will be allowed to use the coupon. If no role is selected, the coupon is not restricted to any roles. It’s worth noting that for example an Administrator will not be allowed to use a coupon that is restricted to a Contributor and vice-versa. If you want several roles to be able to use the coupon, you must check each role here.
Exclude Roles – exclude roles from using this couponUsers with the chosen roles will not be allowed to use the coupon. The following examples illustrate some cases and configurations where a coupon is limited or applied automatically based on groups or roles. If you are not familiar with the Groups membership plugin yet, we recommend to review its documentation pages where you can quickly learn how to create a group and assign users to it. In the following examples, we will be using several groups with intuitive names. Please note that the Registered group already exists when you install the Groups membership plugin and that all users belong to it. This example shows the settings used for a coupon that is limited to registered users and applied automatically for them. This means that the coupon will be applied automatically for any existing user account, without the need for the customer to input the coupon code at checkout explicitly. In this example, we also exclude any member of the Test group from using the coupon. In this example you can see the settings used for a coupon that is limited and applied automatically for two distributor groups. Here we have an example with settings for a coupon that is restricted to two groups, Level 1 and Level 2. This example shows the settings used for a coupon that can only be used by those who have the Customer role. The limiting groups, groups for which coupons are applied automatically and limiting roles are displayed in the Coupons section under Marketing > Coupons (previously under WooCommerce > Coupons) on your WordPress dashboard. The additional columns Groups, Auto and Roles show if coupons are restricted to members of certain groups, if they are applied automatically to certain groups or if they are restricted to certain roles. Additional filters allow to search for coupons that have certain group or role constraints.
You might also be interested in using the free WooCommerce Coupon Shortcodes plugin which provides additional shortcodes that can be used with your coupons. It allows you to render coupon information and show content based on the validity of coupons.To display pretty coupons, the
[group_coupons] shortcode is used.
Use the shortcode by embedding it on a page where you want to show the coupons handled by the extension to your customers.
Coupons are displayed when valid (validity is based on the user account, coupon settings and the shortcode settings).
- color : defaults to
blue, also supports
yellowfor built-in styles and other values for custom CSS rules
- order_by : defaults to
code, also accepts
- order : default to
ASC, also accepts
- auto : defaults to
no, whether coupons that are automatically applied should be included, use
yesto include those
- groups : defaults to
yes, whether coupons that are limited to groups should be included, use
- roles : defaults to
yes, whether coupons that are limited to roles should be included, use
- show_cart_invalid : defaults to
true, coupons that require cart conditions to be valid should be included although the current cart does not meet those conditions, use
- stylesheet : indicate a URL to load a custom stylesheet, when empty will not load a stylesheet, defaults to
nulland loads the stylesheet with built-in styles
- show_discount : By default, coupons show the type of discount. Use
show_discount="no"to disable that.
Only auto – To only display coupons that are applied automatically:
Only roles – To display coupons that are valid for the user based on roles only:
[group_coupons auto="yes" groups="no" roles="no"]
All group coupons – To display coupons that are valid for the user based on groups and roles:
[group_coupons auto="no" groups="no" roles="yes"]
The extension includes some translations and a translation template which you can use to create your own translation as needed. The extension uses flexible language translation which will use a language-generic translation if no country-specific translation is available (this can be disabled by setting the
[group_coupons auto="yes" groups="yes" roles="yes"]
WGC_STRICT_LOCALE constant to
true in your site’s
wp-config.php). For example, although there are several formal and informal translations for the German language and several countries, the included translation is a generic one for the German language in general. The translation files included in the extension’s
languages folder for the German language are
woocommerce-group-coupons-de.mo and those will be used unless a country-specific translation is encountered.