• Resolved yukafox

    (@yukafox)


    Hi.
    So I recently instaled your pluging. Before I had a code which changed output of variable product price in loop:

    add_filter('woocommerce_variable_price_html','from_variation_price_format',4,999);
    function from_variation_price_format($price, $min_sale_price,$max_sale_price ,$min_reg_price){
       global $product;
       if ($product->is_type( 'variable' )) {
          if ($product->is_on_sale()) {
             if ( $min_sale_price < $min_reg_price ) {
                return '<del>' . wc_price($min_reg_price) .'</del>' . pll__('From','frontmed') . ' ' .wc_price($min_sale_price);
             } 
          } else {
              return pll__('From','frontmed') . ' ' .wc_price($min_sale_price);
          }
       }
    }

    It worked before but now stoped. I found another:

     add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format_min', 9999, 2 );
    function bbloomer_variation_price_format_min( $price, $product ) {
      $prices = $product->get_variation_prices( true );
      $min_price = current( $prices['price'] );
      $price = sprintf( pll__( 'From %s %s', 'frontmed'), wc_price($min_price), $product->get_price_suffix() );
      return $price;
    }

    But I don’t know how to get sale price. Could you support me with it?

    • This topic was modified 2 years, 10 months ago by yukafox.
    • This topic was modified 2 years, 10 months ago by yukafox.

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

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Only minimum price’ is closed to new replies.