Title: factoriatech's Replies | WordPress.org

---

# factoriatech

  [  ](https://wordpress.org/support/users/factoriatech/)

 *   [Profile](https://wordpress.org/support/users/factoriatech/)
 *   [Topics Started](https://wordpress.org/support/users/factoriatech/topics/)
 *   [Replies Created](https://wordpress.org/support/users/factoriatech/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/factoriatech/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/factoriatech/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/factoriatech/engagements/)
 *   [Favorites](https://wordpress.org/support/users/factoriatech/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Role Based Price For WooCommerce] Role based price not updating with cron job from wp all import](https://wordpress.org/support/topic/role-based-price-not-updating-with-cron-job-from-wp-all-import/)
 *  [factoriatech](https://wordpress.org/support/users/factoriatech/)
 * (@factoriatech)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/role-based-price-not-updating-with-cron-job-from-wp-all-import/#post-9021283)
 * 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.

Viewing 1 replies (of 1 total)