Easy Mailchimp Integration
I worked up a quick tutorial to demonstrate how easy it is to add customers to a MailChimp list during the checkout process.
1. Go to Mailchimp and login to your account. Go to the Account button dropdown and select “API Keys & Authorized Apps”. If you don’t have one yet, create a new API Key and make a note of it. Next, click on the Lists button. Find the list to which you’d like to add customers and hold your mouse over the settings dropdown. Select “list settings and unique id” and scroll to the bottom of the page. Make a note of the unique ID for this list.
2. Get the code at http://pastebin.com/gfqjPQHv and paste it into the foxyshop-datafeed-endpoint.php file in your template folder. If you don’t have one in your template folder, grab the one from plugins/foxyshop/themefiles and copy it there. Paste the code after the line that says “//If you have custom code to run for each order, put it here“. Replace the x’s with your API key and list ID. If your list doesn’t use FNAME and LNAME, you’ll want to adjust the Merge Vars as well, but all lists come with those fields by default. If you haven’t changed anything on your list, you don’t have to worry about it. You can add address fields and populate those as well if you’d like. Just make sure you add the corresponding fields to your MailChimp list.
3. Download this file, unzip it, and put it in your theme directory. If you are using a child theme, put it in your child theme directory.
4. Go to your FoxyCart admin, click on Templates / Checkout, and paste this code at the bottom of your template. Note: if you are using FoxyCart 2.0+, skip this step and just turn on the “Let Your Users Signup For Your Newsletter” feature in your FoxyCart admin (configuration section).
5. If you aren’t already using it, make sure you turn on the FoxyCart datafeed (Store / Advanced). You can find your datafeed url in your FoxyShop settings page.