Ninja Forms

Want to use your own Ninja Form as a custom affiliate registration form? The Affiliate Forms for Ninja Forms integration allows you to seamlessly connect Ninja Forms with AffiliateWP, enabling you to create custom affiliate registration forms while adding powerful features like email tags and mailing list sign-ups.

This guide will walk you through the installation, setup, and key features of the Affiliate Forms for Ninja Forms integration.

Enabling the Ninja Forms Integration

  1. Before we get started, be sure to install and activate AffiliateWP on your WordPress site.
  2. Ensure Ninja Forms version 3.0+ is installed and activated.
  3. To enable integration with Ninja Forms, go to AffiliateWP » Settings » Integrations and check the box next to Ninja Forms. Click Save Changes

Setting Up AffiliateWP Referral Actions in Ninja Forms

  1. In the WordPress admin menu, go to Ninja Forms and click the Add New button.
  2. You can either select one of the pre-made form templates or start from scratch with a blank form. Add at least a couple of fields (for example, First Name and Email).
  3. You will also be required to add a Submit button.
  4. To enable referrals to be generated for this form, go to the Emails & Actions tab. Click the Plus (+) icon in the bottom right corner of the page.
  5. Click the Add Referral option under the INSTALLED ADD-ON ACTIONS section.


  6. This will add a new Action called “Add Referral” to the form.

  7. When the Add Referral action has been added, your form will now generate $0.00 referrals for affiliates who refer form submissions.  If this is OK for your setup, you are finished!
  8. If you would like AffiliateWP to calculate a specific referral amount for each form submission, or set a specific referral Description or Referral Type (Sale, Opt-in, or Lead), You can fill options on the right-hand side of the page.

  1. To calculate a specific referral amount for each submission (using a referral rate type of percentage), you will need to add optional fields to store values such as quantity and pricing if you’d like the user to select/set these values before submitting the form. You can name these fields whatever you like.
  2. To perform a calculation, Use the Advanced – Calculations action to perform any multiplication, addition, etc. to come up with a total. Helpful video tutorial on how to use the Calculations feature in Ninja Forms: https://ninjaforms.com/docs/calculations/.
Ninja Forms calculations

Otherwise, you can place a single numeric value in a field of your choice to be used for the final referral calculation.

Example of setting a flat referral rate

If Ninja Forms is your only integration with AffiliateWP and you want to set up a $2.00 commission for each form submission, you can do so by entering a Flat Rate of “2” in AffiliateWP » Settings » Commissions » Referral Rate and selecting the referral rate type as “Flat”.

This configuration ensures that whenever an affiliate refers a visitor who completes and submits the form, a $2.00 commission will be generated for the affiliate, without needing to specify a total amount.

Example of setting a Percentage referral rate

If you wish to use a Percentage referral rate type (e.g. you have multiple integrations and/or forms, or you would prefer to work with percentages), and you wish to generate a $5.00 affiliate commission on every submission of this particular form, you could set a global Referral Rate of 20% in AffiliateWP’s settings, and enter “25.00″ in the field you are using as your TOTAL FIELD assignment you’ll set as shown below. When an affiliate successfully refers a visitor, and the visitor completes and submits this form, a commission of $5.00 will be generated for the affiliate.

Mapping the form with merge tags

If you have set up your form to calculate a specific referral rate based on the final total amount field, follow the steps below.

  1. Click on the click on the cog icon next to Add Referral to edit the action. You’ll see some new options appear on the right-hand side of the page.
  2. In the Total field, click on the menu icon. Select the corresponding merge tag from your form. As per the below example, the merge field tag is Total, but the field can be named whatever you like.
  3. For any other fields in your form, click on the menu icon. Select the corresponding merge tag from your form. As per the below example, we’ve merged the email field in the form with the Email merge tag. Repeat this step as necessary to map your form.
  4. In the Description field, enter some text that clearly describes where the referral came from, such as “My Contact Form” or “My First Product”, etc.
  5. Click the Done button.
  6. Click the Publish button.
  7. If you haven’t already given your form a title, you’ll be prompted to do so. Give your form a title and click Publish again.

Your form is now ready to insert on any page or in any post! Now, when an affiliate refers someone to your site, and that person completes this form, the affiliate will be awarded a commission based on what you have set in the form and/or AffiliateWP’s General settings.

Frequently Asked Questions

How do I enable Ninja Forms integration with AffiliateWP?

To enable integration, ensure both AffiliateWP and Ninja Forms are installed and activated. Then, navigate to AffiliateWP » Settings » Integrations and check the box next to Ninja Forms. Save the changes to activate.

How can I generate referrals from Ninja Forms submissions?

After adding the form fields and a submit button, access the Emails & Actions tab in the form editor, click the Plus icon, and select ‘Add Referral’. This will enable referral generation from form submissions.

Can I set specific referral amounts or types in Ninja Forms?

Yes, by editing the ‘Add Referral’ action, you can specify the referral amount, type (e.g., Sale, Opt-in, or Lead), and description for more precise tracking.

What if the predefined fields like ‘Product’ and ‘Total’ are unavailable?

If these fields are missing (as of Ninja Forms version 3.4.6), you can use custom fields and the Calculation action to determine totals for referral calculations.

How do I ensure correct referral calculations using Ninja Forms?

Use the Calculations action for dynamic field values or set a static numeric value in a field for the final referral calculation, which will be processed based on the set referral rate and type in AffiliateWP’s settings.


That’s it! By following this guide from installation and setup to configuring specific referral rates and mapping merge tags, you’ll improve the effectiveness of your affiliate program and simplify its operations. Whether you’re using flat or percentage-based referral calculations, this integration ensures accurate and efficient commission tracking for every affiliate-driven form submission, making it an essential tool for optimizing your marketing strategy.