Create a Woocommerce product widget with category filter

The plugin you posted creates a new widget with 2 input fields. One field for the title of the widget, another field to enter a comma separated list of product ID´s.

You can change the provided code, to be able to enter a comma separated list of product_cat ID´s. (instead of product ID´s)

You only need to change the $query_args for the WP_Query.

First, remove the line 'post__in' => $arr_id. Instead we are gonna add the $arr_id(containes the list of ID´s) to a new tax_query.

Change the code:

$query_args = array(
  'post_status'    => 'publish',
  'post_type'      => 'product',
  'no_found_rows'  => 1,
  'posts_per_page' => -1, //-1 needed for displaying all posts of the category
  'tax_query' => array(
     array(
      'taxonomy' => 'product_cat', //the taxonomy we want to query
      'field' => 'term_id', //we use the term_id tp find our terms
      'terms' => $arr_id //our comma seperated list of ID´s
     )
  )
);

Now you can enter a comma separated list of product_cat ID´s in the widget. All products which are in these cats will be displayed.

P.S.
Codex for tax_query: WP_Query #Taxonomy_Parameters.
Limit the displayed posts with 'posts_per_page' => -1. WP_Query #Pagination_Parameters
Also take a look at order and orderby args. WP_Query #Order_Orderby_Parameters
And also watch your commas on the $query_args list!