How to add “allowed user roles” in coupon ?
-
The usage restriction for Woocommerce coupons does not have the “Allowed user role” feature. I need to limit the coupon to “Guest”. So I added the following code to the theme’s functions.php: a.simplefood.tw/wp-content/plugins/woocommerce/includes/admin/meta-boxes/the_code_added_to_functions.txt
This is what the console coupon looks like:
a.simplefood.tw/wp-content/plugins/woocommerce/includes/admin/meta-boxes/coupon_data_edit.jpgThen, I generated 1 coupon in the console. “Allowed user roles” select “guest”. I tested and everything works fine: Guest can use it to checkout, other role users cannot.
But when I use it as a “coupon template” for AffiliateWP Dynamic Coupons I get an error. When asking AffiliateWP to batch generate dynamic coupons for affiliate members, an error occurred: Guest and any other user can use it to checkout
It seems that AffiliateWP ignores the code in functions.php when generating dynamic coupons.
I want to put the code above in functions.php into the Woocommerce coupon file:
a.simplefood.tw/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.txtHow should I modify to keep those codes? Modify and delete those codes? Where is it added?
I know that the official does not recommend directly modifying the original code, but this should be the easiest and feasible way now. Please help me, thank you very much.
The page I need help with: [log in to see the link]
- The topic ‘How to add “allowed user roles” in coupon ?’ is closed to new replies.