Title: Zero prices
Last modified: August 24, 2016

---

# Zero prices

 *  Resolved [chrislomas](https://wordpress.org/support/users/chrislomas/)
 * (@chrislomas)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/zero-prices/)
 * Hi,
 * in order to get this to allow me to set a zero price for certain roles, I had
   to make some changes to the plugin:
 * public function role_based_price_all($price, $product) {
    $sale_price = $this-
   >role_based_sale_price($price, $product); $regular_price = $this->role_based_regular_price(
   $price, $product); $return_price = ”;
 *  if (isset($sale_price) && $sale_price < $regular_price) {
    $return_price = $
   sale_price; } else if (!isset($sale_price) && isset($regular_price)) { $return_price
   = $regular_price; } if (isset($return_price)) { return floatval($return_price);}
   return $price; }
 * Changed !empty() to isset()
    Changed return $return_price to return floatval(
   $return_price)
 * I hope this helps someone.
 * Chris
 * [https://wordpress.org/plugins/woocommerce-role-based-price/](https://wordpress.org/plugins/woocommerce-role-based-price/)

Viewing 1 replies (of 1 total)

 *  [esayer](https://wordpress.org/support/users/esayer/)
 * (@esayer)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/zero-prices/#post-6049871)
 * What file did you add this to?
 * Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Zero prices’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-role-based-price.svg)
 * [Role Based Price For WooCommerce](https://wordpress.org/plugins/woocommerce-role-based-price/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-role-based-price/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-role-based-price/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-role-based-price/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-role-based-price/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-role-based-price/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [esayer](https://wordpress.org/support/users/esayer/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/zero-prices/#post-6049871)
 * Status: resolved