• Resolved flankers

    (@flankers)


    Hello,

    I’m using Elex dynamic pricing on one of my websites and it’s working great!

    But I’m encountering a little trouble regarding the price display:
    I want to disable the variable product price range which usually looks like $100-$999 and replaces it with: “From: ” in front of the minimum price.

    In order to achieve this I was using this snippet on my child theme function.php file:

    add_filter( 'woocommerce_variable_price_html', 'from_variation_price_format', 9999, 2 );
      
    function from_variation_price_format( $price, $product ) {
       $prices = $product->get_variation_prices( true );
       $min_price = current( $prices['price'] );
       $price = sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $min_price ) );
       return $price;
    }

    This snippet was also working great prior to the activation of the ELEX plugin, and when I deactivate it, it works again.

    Is their any way to combine this nice plugin and my way to display prices?

    Thanks in advance! ??

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ELEXtensions

    (@elextensions)

    Hello, Yes, this is not working with the custom code you have written as the plugin also uses the same hook to return the price. Hence if you would like to hide the price range you may try changing the priority of the hook or may also try with a CSS to hide the price range.

    Thread Starter flankers

    (@flankers)

    Hello,

    Thanks for your prompt reply.
    I have tried to change the priority of my hook but it was not working. Also, CSS seems not to be a viable alternative.

    I decided to take a further look at the plugin file and find the related hook. I was then able to solve my problem with this snippet:

    add_filter('eha_variable_sale_price_html','from_variation_price_format',4,999);
       function from_variation_price_format($price, $min_sale_price,$max_sale_price ,$min_reg_price)
       {
           return "From: ".wc_price($min_sale_price);
       }

    Maybe this will be helpful for other people that encounter the same behavior. ??

    Plugin Author ELEXtensions

    (@elextensions)

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“From..” price display’ is closed to new replies.