I solved it, but you gotta know a bit of PHP to make it work.
step #1. I created a function and placed it in my functions.php file:
function my_prices($p1,$p2,$p3,$p4){
$result = [];
$result[‘cliente1’] = array (‘regular_price’ => $p1,’selling_price’ => ”);
$result[‘cliente2’] = array (‘regular_price’ => $p2,’selling_price’ => ”);
$result[‘cliente3’] = array (‘regular_price’ => $p3,’selling_price’ => ”);
$result[‘cliente4’] = array (‘regular_price’ => $p4,’selling_price’ => ”);
$x = serialize($result);
return $x;
}
(You gotta replace cliente1, cliente2 etc.. with the name of the user roles.)
Step #2 You have to add the custom field “_role_based_price” and on the value add the function like this:
[my_prices({price1[1]},{price2[1]},{price3[1]},{price4[1]})]
This way the field (prices) will always be updated regardless of a cron or manually. Any questions, Im free to help. I tried to solve this without programming but couldnt find a way.