there is a simple plugin if you want to use called Woocommerce Extended Coupon Features Free. This is a freemium plugin but adds enough options to be able to do what you want. Link for the plugin
https://wordpress.org/plugins/woocommerce-auto-added-coupons/