PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Override with child theme function.php woocs_recalculate_order_data

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello,

I would like to set another capability for the plugin because the"manage_options" capability gives too many permissions to my backend users.

Users without the manage_options cannot change the currency for manual orders in the backend.

How can I override this in my child theme fucntions.php?

I believe it's two functions found in \classes\woocs.php, one called"woocs_recalculate_order_data" and the other called"woocs_recalculate_orders_data".

These two public functions seem to check for the manage_options capability. I would prefer this to be the can"create shop orders" capability.

Thanks

Hello

Unfortunately, you can't override this code in a child theme.

Hi Pablo,

Thanks for your reply. In that case I would suggest the main plugin is updated to use a different capability / permission, as per my suggestion.

I have tested changing"manage_options" to"create_shop_orders" updating the below two lines of the code.

I can confirm this works without giving users full permission control over the whole of WooCommerce options and settings! which is bad.

The file I made the code changes is located here: \classes\woocs.php

Line number 4695:

public function woocs_recalculate_order_data() {

if (!current_user_can('create_shop_orders')) {  // Allow to change currency on manual orders with can create shop orders instead
//if (!current_user_can('manage_options')) { // commented out and replaced with above as this gives too many permissions to control WooCommerce options

Line number 4703:

public function woocs_recalculate_orders_data() {
if (!current_user_can('create_shop_orders')) { // Allow to change currency on manual orders with can create shop orders instead
//if (!current_user_can('manage_options')) { // commented out and replaced with above as this gives too many permissions to control WooCommerce options

The above change allows any user that create create shop orders in hte backend to change currency without giving full permissions to control all the settings of WooCommerce options.

Note: I use a capabilities plugin (Plublish Press) to restrict user permissions as I do not want to provide full control of the backend to my staff users.
This is much safer and provides a nice simply backend set of menus. It doesn't allow my non-technical employees to accidentally alter or change any settings, as this is dangerous to allow. I have edited the capabilities for the default role of 'shop manager' and create new custom roles for my sales staff, allowing them backend access to create sales orders.

And now, because of the above code change my sales users can now safely also change the currency of manually created orders in the backend.

 

Can you please update your base code of the plugin with my suggested change, so I don't have to edit the code with each plugin update.

This is much safer way of allowing to change currency for manual orders.

 

ok! I passed your suggestion to the developers

Thank  you for your  cooperation!