SkyVerge WooCommerce Extensions

WooCommerce Memberships has the ability to provide discounts for members. This is a popular way to provide perks or wholesale pricing for certain groups of customers.

However, Memberships does not have complex sets of rules for for pricing, such as the ability to set discounts at tiers for membership products. You can use Dynamic Pricing for this sort of set up, as it lets you add pricing rules based on role, quantity tiers, and more. There’s just one problem: Dynamic Pricing doesn’t recognize membership types for its discount rules.

This is a good use case for our free Role Handler plugin for Memberships. This plugin lets you change the role a member has on your site while they possess an active membership; that role can then be changed when the member becomes inactive. This gives you a way to bridge compatibility between plugins that support roles, but not Memberships.

Configure roles for members

The first step is to create a role I’ll use exclusively for active members. In this example, I’ve added a “Member” role using the free User Role Editor plugin. I’ve cloned the “Customer” role to create this role, so it’s functionally no different than other customers.

However, I can now use this with my Role Handler plugin. Under WooCommerce > Settings > Memberships > General, I can update settings to use the “Member” role for active members, and revert back to “Customer” for inactive members.

WooCommerce Memberships Role Handler Settings

Role Handler settings

Now when a member becomes active, they’ll switch to the “Member” role, and then when they become inactive, they switch to the “Customer” role.

This will not apply to members that already exist. You’d need to either mark them paused, then reactive the memberships, or manually update your existing members’ user roles.

Configure Dynamic Pricing

From here, I can now configure Dynamic Pricing to work with my custom role for members. I could do something pretty general like adding an overall discount for members with my “Member” role under WooCommerce > Dynamic Pricing.

Memberships role-based dynamic discount

However, this isn’t too useful to us, given Memberships can do this already easily as a discount rule. The real power of this integration lies in the product pricing rules. Now, I can create tiered discount rules or promotional rules that only relate to the member role on my site.

For example, let’s provide a discount for members when they purchase a minimum quantity of a given item.

Memberships product dynamic pricing

Dynamic Pricing product rules

When a non-member adds a quantity within this range, they won’t see a discount available from Dynamic Pricing:

WooCommerce Memberships Dynamic Pricing non-member view

Non-member view

However, if an active member does the same thing, they’ll have the “Member” role, and will now see that discount available on the item:

WooCommerce Memberships Dynamic Pricing member view

Member view

The Role Handler plugin gives you a simple way to bridge the gap between Memberships and other WordPress plugins or WooCommerce extensions that rely on roles, connecting them to your active members.

Published by Beka Rice

Beka leads product direction for SkyVerge and technical documentation. She spends a lot of time on research and interviews, but likes to write so she has an excuse to spend more time jamming out to anything from The Clash to Lady Gaga.

3 Comments

  1. Hey Beka. Curious, is Role Handler addon set up to work when the user has multiple roles? For example https://wordpress.org/plugins/members/ enables ability to assign multiple roles to anyone, and I’ve seen some plugins get confused with that before.

    Reply
    • Here’s what it does under the hood:

      1. If the customer becomes active, it removes the “inactive” role (probably customer). It adds the active role (usually a custom “member” role).
      2. If the customer becomes inactive, it removes the “active” role and re-adds the inactive role (customer).

      If the user had a role aside from your inactive role to begin with, then the new role is added, but nothing is removed. So let’s say I had an “Author” on my site, and my inactive role is “Customer”, while my active role is “Member”. When this author buys a membership, s/he has both author and member roles after the membership is activated.

      This does indeed work with Dynamic Pricing if there are multiple roles, so long as one role for the user is your target role. In the Role Handler’s case, it’s only doing the role adding and subtracting, so it’s up to the plugin using the roles to check something like “in_array()” rather than a check for a specific role (given > 1 role is a WP core feature, it’s not exclusive to Members).

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *