Code

WooCommerce Role-O-Matic

WooCommerce Role-O-Matic

Cart 495 sales

The WooCommerce Role-O-Matic plugin (WCRA) is a powerful tool that allows the shop admin to create “assignment rules” that dynamically assigns roles to the customers according to the amounts spent during the configured time periods or according to the purchased products. This tool can be very useful because can be used together with the WooCommerce Pricing! (or any 3rd party plugin) to assign dynamic prices or discounts according to the assigned roles.

LIVE DEMO

https://www.codecanyondemo.work/wcra/wp-admin
user: demo
pass: demo

user: demo2
pass: demo

user: demo3
pass: demo

How to automatically update the plugin

To receive automatic updates just install and configure the Envato updater plugin: httpss://goo.gl/pkJS33 .The official guide that explains how to configure it can be found in the following link: httpss://envato.com/market-plugin .

HOW IT WORKS

It’s very straight-forward. Once installed and activated, a new “WooCommerce Role-O-Matic” voice will appear in the main menu from where the shop admin can access to the Amounts configurator or the Products configurator menus by which the “role assignment rules” can be configured.

By the Amounts configurator can be defined rules by which roles can be assigned according to the amounts spent (excluding taxes) during the configured time periods, according to the user roles, minimum amount spent (and optionally a max amount spent) and products/categories restrictions.
Every time a customer places an order or if the shop admin saves an order or if he changes an order status (using the WC_Order method or the admin area), the plugin will check if exists any “amount role rule” matching the current time and amount spent appling it to the customer. Optionally every rule assignment can be deferred specify another date in which the role assignment has to take place.

By the Products configurator roles can be assigned according to the purchased products. Once the order is placed, to the customer will be assigned the rules associated to the purchased products. Furthermore can be also configured expiring dates, products pruchase restriction an more.
This can be very useful to manage subscription plans.

Amounts configurator – ASSIGNMENT RULES

Using the Amounts Configurator menu can be created assignment rules with the following options:
  1. Rule name: used to identify the rule
  2. Time period type: Fixed time period(s) (You can define multiple dates) or Dynamic (To define time span like “Last 6 month” or “Last 24 hours”)
  3. Dates (if fixed time period(s) has been choosed): you can configure multiple date used to compute the amount and during which will be assigned the selected role(s)
  4. Effective computation date: This option is useful if you want to assign roles in a deffered date. For example you can use Febraury spent data to assign special roles during June
  5. Time range span (if dynamic time period has been choosed): The span of the time range from “now” (where now is the moment in which the user accesses the site) to be used for orders retrieval to compute the amount spent. During this period if a rule match is detected selected roles will be applied
  6. Time type (if dynamic time period has been choosed): it can be minutes/hours/days/months/years
  7. Role(s) restriction: You can choose to apply rule of if the customer already has one or more roles.
  8. Products/Categories restriction: You can choose to apply rule only if the customer has spent the desidered amount range in the selected products/categories.
  9. Minimum/Max Amount: these are the min/max amout spent value (excluding taxes) that the customer must spend in one of the configured period. If so, the selected role(s) (in next step) will be assigned.
  10. Role(s) to assign(1): Roles to assign to the customer if the amount has been spent during the configured periods.
  11. Role(s) removal: If an user already has one of the roles to assign but he has not spent the configured amount during the period, roles are removed.
(1)Role has to be created befor creating the rule. To create a role use the Embedded Role Editor or any other 3rd party plugin.

Products configurator – ASSIGNMENT RULES

Using the Products configurator the shop admin can easily associate to products one or more user roles. Therefore customers that will buy those products will be assigned the associated role(s). This could be useful to manage subscription plans based on roles.

Optionally the shop admin can also set an expiring date that once reached will trigger the user role removal. The expiring date can be relative or fixed.
The first one is relative to the purchasing time, this mean that the expiring time could be for example 1 month later the purchase. The second one is a fixed date, like “March, 2nd 2016”.
Furthermore you can also restric products purchasing if the current customer already have the selected roles. You can also deny rebuying the products if the expiration date has not been reached.

Roles are assigned and removed automatically according to the purchasing date and expiring date. The purchasing date is the date in which the latest order (by date not by id) marked with one of the allowed statuses has been placed.

Example: if you set as allowed statuses “processing” and “completed” and if the default status when an user places an order is “payment pending”, the purchase time and roles will not be assigned until the order is marked as “processing” or “completed”.
NOTE: Changing latest order date will automatically update puchasing date for the order items that have roles associated.
You can set the allowed order statuses by the General options menu.

Expiration date extension: The plugin allows the shop admin to let customer to rebuy or not a product. In this way, in case e relative expiration date is associated to the product, after placing an order the purchase date is updated to the date the order has been placed.

SHORTCODE: To let you customer know when their products will expire you can add the [wcra_show_expiring_dates] shortcode in any page. It will display the products expiring date for the current user.

AUTOMATIC ROLE RECOMPUTATION

The plugin gives the ability to autmatic recompute roles (only for “role amount rules”) at regular time intervals. The shop admin usin the General options menu have to enable this option and choose a time span interval (ex.: every 2 hour, every 7 days, etc.) and a starting time and the plugin will recompute user role according to the existing rules!
User roles based on products are also automatic recomputed when the customer access the site.

NOTE: You can set the allowed order statuses considered during the computation by the General options menu.

Role Re-Calculator tool

By default roles assignment rules are checked after a customer has placed an order, after one of its order has been edited in the admin page, after one of its order status has been update (using the WC_Order method or the admin area) or during a recomputation schedule.
If the shop admin would like to computer roles (only for “role amount rules”) without waiting, he can use the “Roles re-calculator”. He simply have to click on “Roles re-calculator” menu voice and then hit the “Recompute” button and the plugin will do the rest. That’s it!

NOTE: You can set the allowed order statuses considered during the computation by the General options menu.

Note on role recomputation methods

WordPress and Woocommerce haven’t a real scheduler. So the plugin will recompute the user roles each time the user accesses the site or according the Automatic role recomputation options that can be set via the General options menu. This method uses the native wp_schedule_event method ( https://codex.wordpress.org/Function_Reference/wp_schedule_event ). The schedule event action will triggered only when someone visits your WordPress site if the scheduled time has passed. So it may happent that the role will removed/assigned some time after the scheduled date.

EMBEDDED ROLE EDITOR

The WCRA plugin have a inbuilt role editor that allow the shop admin to easily create new roles or delete old or inused ones. Roles can be used to assign special discount or prices using the WooCommerce Pricing! or any 3rd party plugin.

KEEP AN EYE ON CURRENT ASSIGNED ROLE AND NEXT ACHIEVABLE ROLES!

The plugin automatically adds to the user My Account page, on Dashboard tab, Two new sections that helps the user to know which role has and which roles are achievable during the current period. The plugin shows how much he spent, how much he misses and the end date!
Both sections can be disabled via the plugin options menu. NOTE: My Account page info display is only avaiable for WooCommerce 2.6 and later.

SHORTCODES
Want to display those section in custom pages? No problem!
Using the [wcra_current_roles] and [wcra_next_roles_list] you can display each section in every page supporting shortcode system!

NOTE: using the special parameter roles_to_not_show you can avoid to display the desidered roles in the role list. Example: [wcra_current_roles roles_to_not_show=”role_code1,role_code2”]

Email notification on role(s) assignment

For role by amount spent rules you can option configure a notification email for each configured rule! In this way you can give some feedback to your users!

Amounts configurator – Rule Assignment Examples

Would you like to assign a special “Premium user spring 2016” role to all the customers who have spent at least 100 during spring season? it’s simple:
  1. Create a new rule and assign a name/id
  2. Time period type: Fixed
  3. Create new dates where (3):
    1. starting date: 20/03/2016
    2. end date: 21/06/2016
    3. Would you like to compute role assignment during a different period?: No(4)
  4. Role restriction: leave unselected
  5. Amount: 100
  6. Max Amount: leave empty
  7. Role(s) removal: Yes (2)
  8. Role to assign: “Premium user spring 2016”(1)
Would you like to assign a special “Month premium users” role to all the customer which have spent at least 100 during the current month? Would you like to apply this special offer only for first 3 month of the year? Here you are:
  1. Create a new rule and assign a name/id
  2. Time period type: Fixed
  3. Create new dates where (3):
    1. starting date: 01/01/2016
    2. end date: 29/06/2016
    3. Would you like to compute role assignment during a different period?: No
    1. starting date: 01/02/2016
    2. end date: 28/02/2016
    3. Would you like to compute role assignment during a different period?: No
    1. starting date: 01/03/2016
    2. end date: 31/03/2016
    3. Would you like to compute role assignment during a different period?: No
  4. Role restriction: leave unselected
  5. Amount: 100
  6. Max Amount: leave empty
  7. Role to assign: “Month premium users”(1)


(1) Role has to be created before creating the rule. To create a role use the Embedded Role Editor or any other 3rd party plugin.
(2) Role are assignment/removal is computed when a customer has placed an order, after an order save on admin page, after an order status update (using the WC_Order method) and during a Schedule. If none of this events take place, you have to start the roles assignment recomputation using the Roles re-calculator at the start of the month (or whenever you whish) in order to remove the roles.
(3) Date rules with starting time greater than “now” are ignored.
(4) If setted to yes, You differ the role(s) assignment using the “spring data” to a different date. This assignment for example could be done of another season (ex: September).

WooCommerce Subscriptions

The plugin supports the following actions triggered by the WooCommerce Subscriptions plugin by Prospress
  1. wcs_renewal_order_created : triggered when an order is renewed
  2. wcs_resubscribe_order_created : triggered when a resubscribe order is created to record a customer resubscribing to an expired or cancelled subscription
When they are triggered, the plugin reperform the role assignment according to the purchased/renewd item associated to the order.

WPML

The plugin works with translated product made using WPML without any issue. Note however that notification emails (product-roles and amount-roles) subjects and bodies cannot be translated.

COMPANION PLUGIN: WOOCOMMERCE PRICING!

Would you like to assign custom prices or discounts to the roles used by the WooCommerce Role-O-Matic plugin? You can!
WooCommerce Pricing is what you need! Give a try!


WooCommerce Role-O-Matic SCREENSHOTS


Current role list and next achievable roles listed (optionally) on My account page








Product configurator

[wcra_show_expiring_dates] shotcode in action

Puchasing date on user admin profile

CHANGE LOG


= 8.9 - 10.03.22 =
* Fixed an issue related to the "Rule application policy" (roles per purchased product) option

= 8.8 - 17.01.22 =
* Fixed an issue due to when an order was placed, the customer role was not properly set

= 8.7 - 03.12.21 =
* Improved email notification system

= 8.6 - 18.11.21 =
* Trashed orders are now excluded from computations

= 8.5 - 27.10.21 =
* Minor improvements

= 8.4 - 13.01.21 =
* Fixed an issue with WooCommerce 4.9

= 8.3 - 14.09.20 =
* Improved role computation process

= 8.2 - 14.08.20 =
* Added option to manually exclude users from the role recomputation

= 8.1 - 06.08.20 =
* Fixed an issue related to chinese character and role names

= 8.0 - 27.07.20 =
* Fixed an issue due to the "role per product" rules were not applied when using categories

= 7.9 - 19.02.20 =
* Minor improvements to the scheduler subcomponent

= 7.8 - 07.11.19 =
* Internal libraries update

= 7.7 - 25.07.19 =
* Minor bugfix

= 7.6 - 25.07.19 =
* Bugfix to the Cron component

= 7.5 - 05.07.19 =
* Minor CSS improvement

= 7.4 - 04.07.19 =
* Fixed an issue related to the automatic role re-comptator

= 7.3 - 03.07.19 =
* Fixed an issue related to the automatic role re-comptator

= 7.2 - 02.07.19 =
* Minor issue related to the role re-computer tool

= 7.1 - 01.07.19 =
* Min/Max amount now can use two digits for decimals

= 7.0 - 27.06.19 =
* Fixed an issue related to order fees

= 6.9 - 26.06.19 =
* Minor bug fix related to the dynamic date computation

= 6.8 - 25.06.19 =
* Fixed an issue related to the date reported using the [wcra_next_roles_list] shortcode

= 6.7 - 15.06.19 =
* Fixed an issue related to "Role by product" rules by which in some conditions, roles were not properly applied

= 6.6 - 10.06.19 =
* Minor bugfix

= 6.5 - 05.06.19 =
* Internal libraries update

= 6.4 - 15.05.19 =
* Internal libraries update

= 6.3 - 21.04.19 =
* Minor bugfix

= 6.2 - 01.04.19 =
* Minor bug fix on admin user details page

= 6.1 - 01.03.19 =
* Added option to send email notification for product role rules 
* Added option "roles restriction" for product roles rules

= 6.0 - 28.02.19 =
* Added option to skip "product role" rule application in case any previous has been already applied

= 5.9 - 28.02.19 =
* Typo
* Added option for "role by product" to set "and/or" purchase relation option

= 5.8 - 25.02.19 =
* Added option to assign product-role according the number of distinct items

= 5.7 - 18.02.19 =
* Fixed an issue with wcs_renewal_order_created filter

= 5.6 - 20.01.19 =
* Minor bugfix

= 5.5 - 21.12.18 =
* Minor bugfix

= 5.4 - 10.12.18 =
* Fixed an issue that may prevent product to be saved

= 5.3 - 07.12.18 =
* Minor bugfix related to WP 5.0

= 5.2 - 13.11.18 =
* Bug fix related to the activation system

= 5.1 - 30.10.18 =
* Fixed an issue with WP-CLI

= 5.0 - 29.10.18 =
* Added activation system

= 4.9 - 06.09.18 =
* Minor bugfix

= 4.8 - 24.07.18 =
* Fixed an issue due to guest cannot purchased item for which other user roles cannot purchase it

= 4.7 - 12.06.18 =
* Fixed an issue that prevented the activation on multisite installations

= 4.6 - 02.05.18 =
* Fixed an issue due to date and time were not properly parsed generating some warning message in the My Account page

= 4.5 - 24.04.18 =
* Fixed an issue that may prevent the registration process to properly complete

= 4.4 - 01.03.18 =
* Is now possible create role by product rule using product categories

= 4.3 - 16.12.18 =
* Minor bugfix

= 4.2 - 15.12.18 =
* Minor bugfix

= 4.1 - 18.11.17 =
* Minor bugfix

= 4.0 - 02.10.17 =
* Minor bugfix

= 3.9 - 21.09.17 =
* Fixed a conflict with  WooCommerce Point of Sale plugin

= 3.8 - 10.08.17 =
* Minor bugfix

= 3.7 - 03.08.17 =
* Minor bugfix

= 3.6 - 05.05.17 =
* Fixed an issue with variable products

= 3.5 - 30.05.17 =
* Added new feature to remove only the selected roles before assigning new ones or before expiration dates

= 3.4 - 07.04.17 =
* Improved compability with WooCommerce 3.0.1

= 3.3 - 07.03.17 =
* Fixed an issue with "Role by products" and exclude by order status feature

= 3.2 - 07.03.17 =
* Fixed an issue with WPML and role per products feature

= 3.1 - 23.02.17 =
* Restored dashboard date & time widget 

= 3.0 - 21.02.17 =
* Added support to upcoming WooCommerce 2.7

= 2.9 - 11.02.17 =
* Added subject field for notofication email
* Removed the offset option. Now the plugin syncronizes itself with the timezone setted in wordpress options

= 2.8 - 02.02.17 =
* Added option to send notification email on role assign

= 2.7 - 10.01.17 =
* Minor bugfix

= 2.6 - 23.12.16 =
* Bugfix

= 2.5 - 20.12.16 =
* WPML bugfix

= 2.4 - 08.12.16 =
* Minor bugfix

= 2.3 - 09.11.16 =
* Added option to assign "expire date roles" for "Product role" 

= 2.2 - 02.11.16 =
* Added new option to remove previous roles when user is buying a "role product" 

= 2.1 - 31.10.16 =
* Bugfix

= 2.0 - 19.10.16 =
* Small bugfix

= 1.9 - 11.10.16 =
* Added option to completely remove user roles before assigning new ones

= 1.8 - 30.09.16 =
* Added new sections on My Account Dashobord to keep an eye to current roles assigned to the user and next achievable roles 
* Added shortcode to render those sections in any page supporting shortcode system

= 1.7 - 22.09.16 =
* Fixed an issue that prevent the proper role assign when where selected categories as restriction filter

= 1.6 - 16.08.16 =
* Minor bugfix

= 1.5 - 26.05.16 =
* Plugin became Role-O-Matic
* Added feature to assign roles according to purchased products

= 1.4 - 14.04.16 =
* Minor bugfix 

= 1.3 - 09/04/16 =
* Added Scheduler: it's now possible to schedule user role recomputation

= 1.2 - 26/03/16 =
* Added new feature to select product by exclusion and include categories children
* Added new feature to compute role assignment in a time period different from the time period in which 
  is computed the amount spent

= 1.1 - 24/03/16 =
* Improved dates configurator
* Added dynamic periods

= 1.0 - 20/03/16 =
* Release

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey