Will AffiliateWP work on a Multisite Installation?
Absolutely! AffiliateWP can be set up so that all sites on the network share the same affiliate data.
- Set up a WordPress Multisite.
- Add the constant below to your wp-config.php file. A good place would be where you were instructed earlier in the multisite installation, just above the /* That's all, stop editing! Happy blogging. */ line:
define( 'AFFILIATE_WP_NETWORK_WIDE', true );
- Navigate to My Sites → Network Admin → Plugins and click Network Activate under the AffiliateWP plugin name. AffiliateWP will now be network activated, and will appear in each sub-site's WP admin interface.
Since AffiliateWP shares its database tables across all sites on the network there's a few things to note:
- Whenever a visit is created on any sub-site, it will show on the Affiliates → Visits page of all sites on the network.
- Whenever a referral is created on any sub-site, it will be shown on the Affiliates → Referrals page of all sites on the network.
- Whenever an affiliate registers on any sub-site, they are an affiliate on all sites. They can then append their referral ID or username to any other sub-site URL and earn a commission if the customer purchases.
- An affiliate has an affiliate area on all sub-sites.
- Creatives are shared across all sub-sites.
- Settings are individual to each sub-site and not shared between them, since these are saved in the wp_options table. This means that each sub-site can have different settings. Don't forget to enable your chosen integration on each sub-site to generate referrals for that site.
If a customer clicks on an affiliate's referral link and then visits a different sub-site on the network and then purchases, does the original affiliate earn commission?
Yes, but only if your multisite network is set up to use sub-directories. If you set up your multisite network to use sub-domains then this will not work unless the affiliate explicitly links to another sub-site using their referral ID/username appended to the URL.
What if I'm moving an existing, standalone AffiliateWP site into a multisite sub-site? Can I retain all of my affiliates and activity to share across all sub-sites on the network?
Yes you can with a few extra steps if you are comfortable removing and renaming tables in your site's MySQL database.
When AffiliateWP is on a single, standalone site it creates a site-specific database. When you move it to a network installation, new network-wide tables are created to be shared across all sub-sites when AFFILIATE_WP_NETWORK_WIDE is set to true (as seen above in Step 2). The tables it creates are prefixed with affiliate_wp* and are empty.
To correct this:
1. Delete the empty tables.
2. Re-name the old tables belonging to the previously standalone site to begin with the same prefix of affiliate_wp*. Refresh, and now you can see all affiliate data from any sub-site on the network.