Roles Assignment Logic

Overview

Since Ultimate Member - Woocommerce 2.2.3 version there is new roles assignment logic, which is more clear and flexible with changing order statuses, refund, or payment completes.

Global settings for orders #

The extension allows you to set different roles after order status changed to complete/refund. You could find these settings in the wp-admin > Ultimate Member > Settings > Extensions > Woocommerce screen:

  • Ignore the roles update, if the user has these roles on complete/processing or refund payment - users who have one of the selected roles will be ignored when changing the order status.
  • Assign this role to users when an order is completed/processing - automatically add the selected role to the user when order is completed or processing (for digital/downloadable products).
  • Upgrade user role when payment is on-hold before complete or processing status - add the selected role above to the user when the order has on-hold status. It just will set the role earlier than completed or processing status.
  • Assign this role to users when an order is refunded - automatically add the selected role to the user when the order is refunded. Please pay attention that this option works only for fully refunded orders. It doesn't work for a partial refund.
  • Remove previous roles when change role on complete/processing or refund payment - when "yes" allows to remove all current roles for the user and set only that roles, which are selected in the options above.
  • Disable subscriptions roles switcher - by default, there can be a conflict between WC Subscriptions plugin options and roles assignment by Ultimate Member - Woocommerce integration for subscription products. Please leave checked to avoid the conflict.

The role data is stored in the order meta. This means that when you change the role in the setting for old purchases, the old setting will apply.

Individual product settings #

The extension allows you to set different roles for the product buyers and remove this role after a product refund. You could find these settings in the WooCommerce Product Add/Edit screen

  • When this product is bought move the user to this role - this role will be assigned to the user when an order with this product is completed/processing and will be removed when this product is refunded.

The extension saves a product settings on purchase and uses saved settings to change a role when the order status is changed. Changing a product setting influences future orders but doesn't influence existing orders.

Individual product settings for subscriptions #

The extension allows you to set different roles for the subscription product buyers and remove/change this role when subscription status is changed. You could find these settings at the WooCommerce product Add/Edit screen.

  • When subscription is ACTIVATED move user to this role - this role will be assigned to the user when the subscription's status is changed to Active.
  • When subscription is PENDING move user to this role - this role will be assigned to the user when the subscription's status is changed to Pending.
  • When subscription is ON-HOLD move user to this role - this role will be assigned to the user when the subscription's status is changed to On hold.
  • When subscription is EXPIRED move user to this role - this role will be assigned to the user when the subscription's status is changed to Expired.
  • When subscription is CANCELLED move user to this role - this role will be assigned to the user when the subscription's status is changed to Cancelled.
  • When subscription is PENDING-CANCEL move user to this role - this role will be assigned to the user when the subscription's status is changed to Pending Cancellation.

The extension saves a product-subscription settings on purchase and uses saved settings to change a role when the subscription status is changed. Changing a product-subscription setting influences future subscriptions but doesn't influence existing subscriptions.

The extension changes the user role when subscription status is changed in this way:

  • a role selected for the previous subscription status is removed;
  • a role selected for the current subscription status is added;
  • all other roles are kept as they are.

There are several cases when the extension doesn't change the user role:

  1. if the current user role is selected in the setting "Ignore the roles update, if the user has these roles on complete/processing or refund payment".
  2. if the role selected for a new subscription status is the same as the current user role.
  3. if the role selected for a new subscription status is the same as the role selected for the previous subscription status.

Role priority #

The WooCommerce plugin automatically assigns a role Customer for any user who buys any product. So, users may have two roles - a role Customer and a role assigned by the extension. This is not an issue. Users in WordPress can have multiple roles. The Ultimate Member plugin uses settings from the user role with the highest priority. All you need is to set a greater priority for a role assigned by the extension. Go to the role settings on wp-admin > User Roles > Edit Role and use the Role Priority setting to set a greater priority for your custom role. Read this article for details.