Requiring members to agree to terms or provide consent can be a requirement for many membership sites. Paid Memberships Pro allows you to add a single Terms of Service (TOS) agreement by default. When members agree, the “Terms of Service” tab records their consent as TOS Consent History. But you’ll need more flexibility if you have multiple terms or policies.

This recipe allows you to add additional required consent checkboxes at checkout and records each agreement in the Terms of Service tab in the Edit Member area. Use it to ensure members acknowledge all necessary terms before completing their purchase.

Featured image for code recipe post on adding additional consent boxes at checkout

Understanding the Code Recipe

Using the  pmpro_checkout_before_submit_button filter,  the code dynamically adds checkboxes for each page that requires consent.
These checkboxes appear at checkout, requiring members to agree to all terms before proceeding. The agreements are validated before checkout and logged after completion, capturing details like the document version and timestamp.

Screenshot of multiple TOS checkboxes at checkout

Your additional pages will appear as links with a checkbox near the end of your checkout page. Users must agree to all checkboxes to complete the checkout process.

Screenshot of multiple checkboxes at checkout with one throwing an error
Screenshot of TOS history inside Edit Member box

How to Use and Customize This Code Recipe

  1. In your WordPress admin, navigate to Pages > Add New. Create the additional page or pages with the information needed for the extra Terms of Service.
  2. Once the page(s) are published, make note of the page ID #.
  3. Enable your first page with the built-in TOS settings.
    Memberships > Settings > Advanced – Other: “Require Terms of Service on signups?”
  4. Add the code recipe to your site.

Note: Do not include the Terms of Service post ID that is set via the settings in Memberships > Settings > Advanced

The Code Recipe

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.

Customizations

Post IDs

Change the numbers on line 21 to the post IDs of your additional pages.
Example return array( 34, 45 );

Wording

Modify line 54 to change the wording that appears at checkout.

Error Message

Modify line 79 to change the error message that appears when a checkbox was not checked before submitting.

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