Download the PHP package boundstate/craft-mailchimp without Composer
On this page you can find all versions of the php package boundstate/craft-mailchimp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download boundstate/craft-mailchimp
More information about boundstate/craft-mailchimp
Files in boundstate/craft-mailchimp
Package craft-mailchimp
Short Description Subscribe users to Mailchimp lists in Craft CMS
License MIT
Informations about the package craft-mailchimp
Mailchimp plugin for Craft CMS 4.x
Subscribe users to Mailchimp lists in Craft CMS
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require boundstate/craft-mailchimp
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Mailchimp.
- In the Control Panel, go to Settings → Plugins → Mailchimp and configure the plugin.
Usage
Your subscribe form template can look something like this:
The only required field is email
. Everything else is optional.
Redirecting after submit
If you have a redirect
hidden input, the user will get redirected to it upon successfully subscribing. The following variables can be used within the URL/path you set:
{email}
{mergeFields}
{tags}
For example, if you wanted to redirect to a subscribe/thanks
page and pass the user’s name to it, you could set the input like this:
In your subscribe/thanks
template, you can access URL parameters using craft.app.request.getQueryParam()
:
Note that if you don’t include a redirect
input, the current page will get reloaded.
Flash messages & API errors
When a subscribe form is submitted, the plugin will set a notice
or success
flash message on the user session. You can display it in your template like this:
If the Mailchimp API returns an error, the plugin also sets the subscription.apiError
variable. You can display it in your template like this: