Repository Forums Support WooCommerce Pricing Rules PRO How to show price 'From…'

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #273

    Thanks for spending the time to develop this plugin. It does exactly what I needed. The only thing that I would like to be able to change is to show the price as ‘from’ the lowest price.

    eg. if the price is £10 for 1 item, or £5 for 5 or more items then rather than showing as £5 – £10 for it to just show as ‘From £5’. I tried to look through the files to work out which part to edit, but my php is too rusty to work out what to change.

    I’d be grateful if you could let me know if there is a simple way to edit this?



    Don’t worry – I worked it out.

    In case anyone else wants to change this, I just replaced the following line in soft79-wc-pricing-rules/soft79-wc-pricing-rules.php:

    return sprintf( _x( '%1$s–%2$s', 'Price range: from-to', 'woocommerce' ), wc_price( $product->get_display_price( $min_price ) ), wc_price( $product->get_display_price( $max_price ) ) ) . $suffix;


    return sprintf( _x( '%1$s%2$s', 'Price range: from-to', 'woocommerce' ), 'From: ', wc_price( $product->get_display_price( $min_price ) ) ) . $suffix;


    Please note using that method, when upgrading the plugin your changes will be lost.

    Version 1.0.4 introduced a filter for this, so you can do something like this in your themes’ functions.php:

    add_filter( 'soft79_wcpr_min_max_price_html', 'soft79_wcpr_min_max_price_html', 10, 6 );
    function soft79_wcpr_min_max_price_html( $new_price_html, $original_price_html, $product, $min_price, $max_price, $is_singular ) {
      $new_price_html = sprintf( _x( 'From %s', 'your-text-domain' ), wc_price( $product->get_display_price( $min_price ) ) ) . $suffix;
      return $new_price_html;
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.