Home › Forums › Add-ons › Options Page › User role option / custom field › Reply To: User role option / custom field
I would probably add a custom field to an options page for each user role that the client wants to set this for. I would name the fields something like
discount_{$user_role}
where $user_role represents the name of each role.
Then when you need to get the value you first get the user role of the current user and then you can get the discount with a single line of code
$discount = get_field("discount_{$user_role}", 'options');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.