207 comments found.
Hi,
I have a rule that gives auto “Member” User role upon hitting $120 value in a checkout.
However, I noticed that the User will have two roles “Customer” , “Member”.
Is it possible to remove “Customer” when he has become a “Member”?
Hi,
yes this is the normal plugin behaviour. It assign new roles according to the amount spent, but it doesn’t remove the already existing ones.
I can add a new feature that removes the old roles whenever a new role (or roles) is added. Keep in mind that enabling this option you will not be able to use the Role(s) removal feature.
Could be ok?
Thank you for the prompt response!
What is the difference on Role(s) removal and how would it impact anything?
How will I be able to get the new feature?
The role(s) removal feature removes the roles assigned if the rule is no longer satisfied.
For example you assign a customer the addtional “Member” if he spens 120$ during the current year. Let’s supporse that last year he spent 120$, so he was Customer and Member. This year hasn’t spent 120$, so the Member role is automatically removed by the plugin. This can be done be cause he still have a base role of Customer.
In case I’ll implement to remove all the current roles and then assign the new one (in this case Memeber), I have to disable the Role(s) removal option for this kind of rule. This to avoid that an user can be without any role.
For what concerns the update, I’ll release via codecanyon. Meanwhile you can send me a private message (click on my name then use the low-right box), I’ll send the update via email.
... But I can easily avoid the case of an user can be without any role. In case a role is removed and the user would have none assigned, the plugin will assign again the base role of Customer…. so do not take care of what I wrote before 
Is it possible to change a role per amount spent per order?
Hi,
no unfortunately the plugin doesn’t not have that feature. It is a good suggestion, I’ll try to see if it can be implemented in a future release, but I cannot give you any eta.
hi its not working for me, not changing the user role. i would really need some guidance. thanks
also i get this: Cannot load woocommerce-role-by-amount-spent.
Is then the plugin active? I need some more clues about your woocommerce installation.
Have you properly installed and activated the plugin? If so you should see the Role-O-Matic menu voice on the left menu.
Could you report me a screenshot of the role assignment rule you are try to appling? would be possible to have a backend access? (if so send me a private message using clickng on my name and the using the low-right box)
Hi,, sorry if this question is already answered in plugin information but I think its not there. If a user has 5 days remaining of X role and he triggers the plugin again to give him 30 days more of that role, does he start with 30 days or with 35? thanks.
My goal is for the plugin to be like a subscription system that changes the roles for the users like someone commented before. If you managed to integrate the plugin with woocommerce subscriptions I would like to know how. I think you can sell much better this plugin if it is like a subscription system. Thanks!.
Hi,
unfortunatelly the plugin for now has not support for woocommerce subscriptions.
what do you exactly have in mind?
What you can currently do by my plugin is to assign roles to users if they have spent a certain amount during a fixed/dynamic time period.
the fixed time period goes from a start to an end date, there is no possibility to dinamic extend end date.
Dynamic time range goest from “now” to the last n minutes/hours/days/months/years.
if you provide a more detailed description of what you have in mind I can try to extend my plugin to work together with the roles created by the woocommerce subscriptions or create roles to be used with woocommerce subscription or whatever 
Thanks for your reply! You are right, I didn’t explain myself very clear. What im trying to do: A user buys a woocommerce product that gives him a special role, the user role is not bundled with some physical product like “buy this product and you can also be an editor on our website”, no, the user role IS the product that the user is going to buy.
-The user can choose to buy role 1 or role 2 or whatever role they want.
-The user would need to be able to extend his period of time by buying more days. Example: I have 5 days left of editor role and I buy 30 days more. Now I have 35 days left.
-When the user has 0 days remaining he is going to have a normal role again.
-There is no need for automatic payments like wocommerce subscriptions provide.
I have searched everywhere and Im 100% sure that there there is no plugin that is focused on buying roles for a user with woocommerce. Your plugin and the woocommerce subscription plugin are close but they are not what a lot of people is looking for. Just search “Woocommerce pay change role” in google and you will see that there is a gap on the market that you can fill. Just a suggestion
.
Actually, I was thinking on hiring someone for $100 to make this but I bet that is not going to be a very nice plugin if a random fiverr guy do it.
Thanks for your time.
The product represent a role that optionally has an expiring time. It could have some variations that rapresent the extended time periods (or something like that).
Example Editor subscription-product has 3 variations:
- subscription for 1 week
- subscription for 1 month
- subscription for 1 year
is that correct?
Yes it can be done, I need some time to think how to design it, if I can extend this plugin or write a new one.
The variations inside the same product is a great idea, although they can be different products if it is more easy to code for you. Example
Product1: Editor subscription 1 week Product2: Editor subscription 1 month
Or you can make it with variations inside the same product. As you wish.
That is correct, a user would not be very happy if they have 5 days remaining and when they buy 30 days more the other 5 days disappear.
I really think that you can be the first one on making this type of plugin that a lot of people requires.
ok, all clear!
I think I can both support product and variations. I’ll let you know in case of news! 
Thank you for the suggestion and the explanation! 
Hi,
good news, I’ve release a plugin update that now allows to associate roles to products.
Plugin page and demo have been updated, it will be ready to download in half a day (codecanyon approval system takes a while).
The plugin is now named WooComemrce Role-O-Matic and now allows you to associate to a product one or more role, expiration date (fixed or relative) rebuy and product buy restrictions.
It has the features you have listed except for the expiration date extension. For now, if rebuy is allowed and the customer rebuys the product, it will loose the remaining day of the old subscription. Is in the work to implement this feaure.
Meanwhile I hope you enjoy 
Hello! First of all thanks for this awesome plugin! Totally I found what I need!
Tell me please how to echo how many money current user spent?
Hi victorslate,
thank you for your words 
For now there isn’t any method by which echoing how much money an user spent.
To know which users beleongs to the various created roles (and so know how much money they have minimum spent) you can go to the Users -> All users menu voice. On the top of the list are reported the current existing roles. Clicking on them you can filter the list and know which usere belong to selected role.
To have a more deep users stats (products bought, how much money they have spent in all time or a specific period, which users have bouught specific products,...) you could consider to use this other plugin of mine: WooCommerce Customers Manager.
Let me know if this could be useful or if you had in mind another idea!
Why not? Here is a method to display: echo wc_get_customer_total_spent() I trying to understand how your plugin processing this function and how can I use it to display anywhere on my site. I need to display spend for selected periods (i.e 12 month).
I’m tried to change Woo function and add this line AND date > NOW – INTERVAL 12 MONTH but this isn’t work…
Maybe you can help? Here is a code:
function wc_get_customer_total_spentNEW( $user_id ) { if ( ! $spent = get_user_meta( $user_id, ‘_money_spent’, true ) ) { global $wpdb; }
$spent = $wpdb->get_var( "SELECT SUM(meta2.meta_value)
FROM $wpdb->posts as posts
}
LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id
LEFT JOIN {$wpdb->postmeta} AS meta2 ON posts.ID = meta2.post_id
WHERE meta.meta_key = '_customer_user'
AND meta.meta_value = $user_id
AND posts.post_type IN ('" . implode( "','", wc_get_order_types( 'reports' ) ) . "')
AND posts.post_status IN ( 'wc-completed', 'wc-processing' )
AND meta2.meta_key = '_order_total'
AND date > NOW() - INTERVAL 12 MONTH
" );
update_user_meta( $user_id, '_money_spent', $spent );
return $spent;
Because the plugin was not designed to offer that feature and never claimed to have. Furthermore support service is not meant to be used as customize service.
However my plugin doesn’t use the nateive wc_get_customer_total_spent(). To compute how much user spent during the configured time period it simply retrieves all orders containing the selected products (if any) in the specified time range and then computes the total amount spent.
This function is the get_orders_by_date_and_user_id() defined in the classes/com/get_orders_by_date_and_user_id(). You can have a look there and try using it.
You could create a shortcode that simply calls it passing the user_id, using as $time_period value the “fixed” one, using as $date_rule an object containing the dates you need (maybe passed as parameter to the shortcode) and null for the $products_restiction paramenter.
Once done you have processes the data that function returns and then displays the total.
I want this if it can support woocommerce subscriptions! Very simple goal, create a role based on active subscription … if subscribe to print, then subscriber-print, if subscribed to digital then subscriber-digital if both then …. do not want to create elaborate groups/memberships data is already there!
Hi shawnholt,
unfortunatelly the plugin doesn’t support any 3rd party plugin. However I could try to see if it is possible to integrate. which is the plugin you are using to manage subscriptions?
can you send me a copy? if so, send me a private message clicking on my name and then use the low-rigth box. I’ll reply with my email address where you can send the plugin.
hi there, just a few pre-sale questions. 1. is it possible to set repeat rules? e.g. at the beginning of each month, it will verify how much money customer has spend during last month/last 3 months and set new rules? 2. when would the change of role happen? at the begining of each month? or at the time of purchase? what is the basis for the amount spend? is it product only? or product+shipping cost, or including tax as well? thanks
- Yes it is possible, but is different as you are describing it. You can specify time rules like specific days of the week of or the month, month, years. So you can define a rule by which you can assign role if the user has spent XXX during every first week of the month, or specific week of the year, or during first semester of the yeasr of so on.
For what concers the Check time it is done by the plugin during the configured periods and after an order is placed. It checks if that user has reached the configure amount and if it is so, it assigns the role.
There is no “concept” of last 3 months/weeks/years. It is a nice suggestion, I can try to add in a future release. - I think I’ve answered in the first question. Check time is done during the configured period after an order is placed (alternatevelly you can recalculate at once for all using the Roles re-calculator tool) . If the user reaches the amount, then the plugin assigns the new role(s)
- The amout is relative to the entire order or you can specify a set of product/categories. In this way the amount is calculated only for the amount spent for the configured products/categories present in the order.
- Amount is products price without tax. Any other additional costs (like shipping or whatever) are ignored.
You can give a try to the live demo site:
http://www.codecanyon.eu/wcra/wp-admin/
user: demo
pass: demo
Feel free to do all the test you want
Hi There,
I am so glad that the suggestion you feel useful. This is exactly the plugin what we need, and it would be even better if following functions can also be achieved: 1. For the product/category restriction section, it only says it can be limited to certain products/category, it would be better if it can also exclude certain products/category, so that no need to include all products if there are many and only 1-2 needs to be excluded. 2. For the role recalculator tool, it is even better to have a periodic setting so that it can execute every amount of time using wp-cron, e.g. every day/week/month 3. add a time effective period(fixed time period) for the effectiveness of each rule. This is quite important because of following scenario: For example, we have following rules set up: a. during 1 January to 31 January, customers who have bought more than $1000 would change the role from customer to customer_level_1. b. during 1 January to 31 January, customers who have bought less than $1000 would change the role from customer_level_1 back to customer. c. during 1 February to 28 February, customers who have bought more than $1000 would change the role from customer to customer_level_1. d. during 1 February to 28 February, customers who have bought less than $1000 would change the role from customer_level_1 back to customer. above 4 rules would conflict with each other if all of them are effective standing on the point of 1 March. This is because customer may have bought more than $1000 in January, but less than $1000 in Feb. Therefore if each rule can be set to be effective only during the specific timeframe, this plugin is going to be perfect.
I hope that these ideas also sounds reasonable to you and can also be added if possible so that no need to manually adjust the rules frequently.
I am also more than happy to discuss with you more about it as this is exactly what many shop managers need.
Thanks, Scott
Thank you very much for your suggestions. Actually they are very usefull. The 1. I can easy implement because I already have some components that filter products by exclusion that I’ve already written and for some other plugin of mine.
For the second one is requires me more work because wordpress has not a real cron job, but I can do something.
I’ll let you know when I’ve some news!
Meanwhile I’ve also released an update that allows you to use “dynamic” time rage allowing to set periods like “last 24” or “last 6 months” from “now” (where now is the moment in which the user places the order)
Hi Vanquish, I am so glad that you feel those suggestions useful.
Regarding the wp-cron, actually it is done by every time when someone visits the website, so actually this is possible, and people like me can also use the host server settings to work around that. As long as it calls wp-cron, it will be executed in the background every 1 minute.
I am also very expecting the item 3 to be included, as this is very critical. “add a time effective period(fixed time period) for the effectiveness of each rule. ” otherwise it would cause conflicts between rules very easily.
If you could release item 3 asap, I will definitely buy it without any doubt.
btw, I am also using your wordpress shipping tracking, very useful. Thank you for hearing me and looking forward for your improvements. – scott
thank you for the purchasing of the shipping tracking plugin, very glad to hear that 
For what concerns the point 3 is just a little bit confusing
would not be better using a customer_level_jenuary_1 and customer_level_february_1 ? (or something like that. Different roles per periods)
However, the idea is to recognize users to which the customer_level_1 has been assigned in the previous timeframe and exclude them in the new timeframe role compuation… right?
In this way in march 1st you could have user which spent in january (and maybe not in february) and febbruary (and maybe not in january) more than 1000$ with customer_level_1 assigned? right?
Hi there, it is actually not quite possible to set many user roles. The main reason is because sometimes people would set up rules based on user roles for both product discount and postage. It would be very difficult to set those rules for many roles. In my case, I have 25 postage rules for 4 roles, and 10 product rules for that for role. Each additional role would increase 12+ rules. Therefore I saw that having an effective timeframe for each rule in this plugin is important.
Yes it will happen. Customers purchase are unpredictable, they can be high in one month, and low in another. We shouldn’t keep on giving them discount even if for a lower month. That’s why if we want to automate this changing role process, need to have an effective date for each rule, so that each rule would not conflict with each other.
So summarizing, we can say that:
- if an user reaches the configured amount (in our example 1000$) in a timeframe the system will assign a special role (in our example the customer_level_1 role), right?
- Once the role is assigned by the system, the customer will not lose it despite in the other timeframe periods he will not achieve the amount goal, right?
The plugin, for every assignment rule, allows you to set the Role(s) removal option that by default is set to No. If it is setted to Yes It removes the role to be assigned if an user already has it and the amount goal has not achieved during the current timeframe periods (the timeframes which have a starting date greater than “now” are not considered by the plugin during the computation).
In your case can be left to the default value. This can be useful? Let me know!
sorry I made you confused. Let us make it this way in following scenario:
1. During 1 January to 31 January, client made a purchase of $1500.
2. His role was changed from customer to customer_level_1 due to his purchase in January.
3. During 1 February to 28 February, he made a purchase of $800.
4. Due to his less purchase, the user role needs to be changed from customer_level_1 back to customer.
To achieve this, I will be setting 4 rules:
a) Rule 1: all clients(except for admin and shop managers) purchase above $1000 during 1 January to 31 January, the role are changed from customer to customer_level_1(with roles removal set to Yes)
b) Rule 2: all clients(except for admin and shop managers) purchase below $1000 during 1 January to 31 January, the role are changed from customer_level_1 back to customer.(with roles removal set to Yes)
c) Rule 3: all clients(except for admin and shop managers) purchase above $1000 during 1 February to 28 February, the role are changed from customer to customer_level_1(with roles removal set to Yes)
d) Rule 4: all clients(except for admin and shop managers) purchase below $1000 during 1 February to 28 February, the role are changed from customer_level_1 back to customer.(with roles removal set to Yes)
In my case, I do want the customer roles to vary automatically according to their purchase during last month. so if rule 1 and rule 2 are only effective during 1 Feb to 28 Feb, and rule 3 and rule 4 are only effective during 1 March to 31 March, it is then perfect, otherwise this four rules would conflict.
Major conflict is between rule 1 & rule 4, and also between rule 2 & rule 3, system would not know which user role the customer belong to if they have spent $1500 in January and $800 in February. And By default, we do not want one customer to belong to two user roles, that is also going to confuse them.
so solution is that if effective date can be set for each rule, then we can set when the rule is effective, so as to avoid conflicts.
also note that the rule effective date(if outside the effective date, the rule is disabled) is different from the time period type (e.g. the dynamic period and fixed periods) The specified time period means this rule is targeted for the sales during that period, but the rule effective date targets for when this rule is enabled.
Further, I don’t quite understand how the fixed periods date work in the rule. As it says, “Date rules have priority that goes bottom-up. Lower rules have higher priority”. So it means that it would only execute the rule for the first met date? I guess it might be better if an option says “And” or “Or” logic to the dates would make more sense.
I am sorry to put forward all above things, Please let me know if you need me to skype with you to discuss further(and I am really willing to as this is quite important for the rule effective date).
Ahh ok I’ve understood. It would be very usefull to specify and additiona effective time period/date in which the rule will be applied (because by now the rules are applied after the starting date is greater than “now”)... right?
So as you say, an user role can be assigned during june using the february month data…. right? this is not hard to implement (sorry if I’m asking confirm many times but I would like to waisting time implementing a thing that I’ve missunderstood
)
By now, as I said previously, all the rules are applied whenever the starting date is greater than “now”. Rules are analyzing using the list order, so if there are two rules conflicting, the lower one would “win”.
For what concerns the 2 and 4 rule according to me can be avoided. Using the 1 and 3 rules with the roles removal option enabled, the customer_level_1 is already automatically removed (if the user has it) if the amout goal is not been reached.
Note that the plugin doens’t switch from a role to another but adds the specified roles to the users.
Anyway send me a private message (click on my name and then use the low-right box) so we can talk via email/chat
Hi there, I’ve sent you a private message. let me know if you didn’t receive it. thanks – scott