add_action('woocommerce_before_cart_table', 'automatic_copons'); function automatic_coupons() { global $woocommerce; if( current_user_can('administrator') || current_user_can('staff') || current_user_can('editor')) { $woocommerce->cart->add_discount('FreeShipping'); } }
Author: Wojciech Borowicz
I hope this post will help you to do what you need.
In case you want some assistance click here to get in touch