Skip to content

AffiliateWP Automations

How to Automatically Make a Customer an AffiliateWP Affiliate When They Buy a WooCommerce Product

Some stores sell a place in their affiliate program, as a course upsell or a starter pack. To make a customer an AffiliateWP affiliate when they buy a WooCommerce product, use Zapify's A product is purchased trigger with the Make the user an affiliate action. AffiliateWP is a Zapify PRO integration.

What this automation does

The automation is one trigger plus one action:

  • Trigger: A product is purchased (WC_PRODUCT_PURCHASED, WooCommerce)
  • Action: Make the user an affiliate (AFFWP_CREATE_AFFILIATE, AffiliateWP)

When an order containing the product you choose reaches a paid status, Zapify creates an affiliate account for the buyer, with the status and rate you set.

PRO feature

AffiliateWP is a Zapify PRO integration, so this automation needs an active Zapify PRO licence.

No Connection needed for AffiliateWP

AffiliateWP runs on your own site, so there is no API key to paste for it and nothing to set up under Settings → Connections.

Before you start

  • AffiliateWP installed and active.
  • WooCommerce installed and active.

How to build the automation

Step 1: Create a new automation

  1. In the WordPress admin, go to Zapify → Automations.
  2. Click Add New to open the builder.
  3. Name it clearly, such as Sell affiliate program access.

Create a new automation

Step 2: Add the "A product is purchased" trigger

  1. Click Add Trigger.

Add a trigger

  1. Choose WooCommerce as the app.

Select WooCommerce as the trigger

  1. Select A product is purchased.

Select A product is purchased

  1. In the Product field, choose the product that should start the automation.

Step 3: Add the "Make the user an affiliate" action

  1. Click Add Action.

Add an action

  1. Choose AffiliateWP as the app.

Select AffiliateWP as the action

  1. Select Make the user an affiliate.

Select Make the user an affiliate

Step 4: Configure the action

Field Required What it does
User No Leave empty to use the user this automation is running for, or enter a user ID or email to act on somebody else.
Status Yes Active approves them straight away. Pending approval puts them in your approval queue.
Rate No A commission rate for this affiliate. Leave empty to use your program's default.
Rate type No Program default, Percentage (%) or Flat amount. A percentage must be between 0 and 100.
Payment email No Where they get paid. Leave empty to use the user's own email address.
Notes No Private notes on the affiliate, shown to admins only.

For example, set Status to Active to approve them straight away, and leave Rate and Rate type on the program default. Leave User empty so the buyer becomes the affiliate.

Step 5: Set the steps Live and save

Each trigger and action has its own Live / Off / Draft switch. A new automation starts as a Draft and does nothing until its steps are Live.

  1. Set the trigger and every action to Live.
  2. Click Save.

Set the automation live

Step 6: Test it

Buy the product with a test customer account, then open AffiliateWP → Affiliates. Zapify → Logs shows User … is now affiliate ….

Tokens you can use

Token What it holds
Billing email / Billing first name / Billing last name The customer's details from the order.
Product names / Product IDs What was bought.
Order ID / Order number / Order total The order itself.

The action makes two tokens available to later actions: Affiliate ID and Affiliate referral URL. If the user is already an affiliate, the action succeeds and changes nothing, so a retry never turns into an error.

Conclusion

With the A product is purchased trigger and the Make the user an affiliate action, buying the product is the application. To welcome them, add a welcome email for new affiliates. Note that an affiliate created this way is added by the action and does not go through the registration form.

FAQs

Is this free in Zapify?

The WooCommerce trigger is free, but the AffiliateWP action is part of the AffiliateWP PRO integration and needs an active Zapify PRO licence.

What if the customer checked out as a guest?

The action needs a WordPress user to make an affiliate. Require account creation at checkout, because a guest order has no user and the run fails with a message saying so.

What if they are already an affiliate?

The action succeeds and changes nothing, so repeat purchases never cause errors.

Can I give them a special rate?

Yes. Set Rate and Rate type on the action, such as 30 percent.

Do I need to write any code?

No. Everything is configured visually in the Zapify builder.

Was this page helpful?