woocommerce only shows

// woocommerce only shows sales prices (For simple products)
	add_filter( 'woocommerce_format_sale_price', 'dcwd_sale_price', 20, 3 );
	function dcwd_sale_price( $price, $regular_price, $sale_price ) {
		return wc_price( $sale_price );
	}
	// woocommerce only shows sales prices (For variable products)
	add_filter( 'woocommerce_variable_price_html', 'dcwd_variable_price', 10, 2 );
	function dcwd_variable_price( $price_html, $product ) {
		if ( $product->is_on_sale() ) {
			$prices = $product->get_variation_prices( true ); 
			$min_price = current( $prices['price'] );
			$price = wc_price( $min_price ); 
			return 'From: ' . $price;
		}
		return $price_html;
	}

Last updated