Membership site owners create discount codes for many reasons: seasonal promotions, partnership offers, and one-time events. After a while, it’s not always clear why a code exists or how it was meant to be used.

This code recipe adds a Description field to the admin view of each discount code, giving you a place to note its purpose, terms, or any other internal details.

Featured image for Add a Description Field to Discount Code for Admins code recipe

Understanding the pmpro_discount_code_after_settings Hook

This recipe uses the pmpro_discount_code_after_settings action hook to add a custom field to the Discount Code edit screen. It hooks into the admin interface where discount codes are managed, so the new field fits in naturally.

About the Code Recipe

This recipe will add a Description textarea field to the Discount Code edit screen when editing a discount code.  You must save the discount code at least once before you can add a description.

Screenshot of the Edit Discount Code screen with a Description textarea field added


Only site admins see the field; it’s not shown on the checkout page or to members. It’s meant purely for internal use.

The Code Recipe

This recipe works on any site running Paid Memberships Pro. No additional Add Ons are required, and no customization is needed.

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

Video: Coding with Sam Walkthrough

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics


Was this article helpful?
YesNo