Different sorting per category in WooCommerce

By default in WooCommerce you can only set how you want to see the sorting of products in the shop. The sorting then applies to all products regardless of the category. Now it may happen that you want a different sorting for a certain category. With the code below you...