'WooCommerce variable products: keep only "min" price with a custom label
In the functions file I have added a filter hook to add a custom label before the variation product "min" price.
How can I get the label in the same line as the price?
See my code and the screenshot below:
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
function wc_wc20_variation_price_format( $price, $product ) {
$min_price = $product->get_variation_price( 'min', true );
$price = sprintf( __( 'From%1$s', 'woocommerce' ), wc_price( $min_price ) );
return $price;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

