The plugin provides the [mautic_woo_subscribe] shortcode for embedding email subscribe forms on any page or post. When a visitor submits the form, their email address is sent to Mautic as a new or updated contact with optional tags applied.
The [mautic_woo_subscribe] Shortcode
This shortcode renders a simple email subscription form with an email input field, an optional consent checkbox, and a submit button. The form submits via AJAX, so the page does not reload. A success or error message is displayed inline after submission.
The shortcode requires the Subscribe Form option to be enabled in the Contact Sync settings tab. When disabled, the shortcode is not registered and will render as plain text.
Attributes
The shortcode accepts four attributes. All are optional.
tag
- Type: string
- Default:
""(empty string) - Description: A Mautic tag to apply to the contact when they subscribe through this form. This tag is applied in addition to the default tag configured in the Contact Sync settings. If left empty, only the default tag is applied.
text
- Type: string
- Default:
"Subscribe" - Description: The text displayed on the submit button.
placeholder
- Type: string
- Default:
"Email address" - Description: The placeholder text shown inside the email input field before the user types anything.
consent
- Type: string
- Default:
""(empty string) - Description: When provided, a consent checkbox is displayed below the email field with this text as the label. The checkbox is not enforced by the shortcode itself but is available for your own compliance needs. When left empty, no checkbox is rendered.
Usage Examples
Basic Usage
Render a subscribe form with all default settings. The button reads “Subscribe”, the placeholder reads “Email address”, and only the default tag from the Contact Sync settings is applied.
[mautic_woo_subscribe]
Custom Tag
Apply a specific tag to contacts who subscribe through this form. The tag “newsletter” will be applied along with any default tag configured in the settings.
[mautic_woo_subscribe tag="newsletter"]
Custom Button Text and Placeholder
Customize the button text and input placeholder for different contexts, such as a lead magnet or gated content.
[mautic_woo_subscribe text="Get the Guide" placeholder="Enter your email"]
With Consent Checkbox
Include a consent checkbox for GDPR or other regulatory compliance. The checkbox label is set by the consent attribute.
[mautic_woo_subscribe consent="I agree to receive marketing emails"]
All Attributes Combined
Use all four attributes together for full customization.
[mautic_woo_subscribe tag="vip" text="Join Now" placeholder="Your best email" consent="I agree to marketing emails and the privacy policy"]
Generated HTML Structure
The shortcode generates the following HTML structure. The data-tag attribute on the form element stores the tag value for the AJAX handler.
<form class="mautic-woo-subscribe-form" data-tag="newsletter">
<input type="email" name="email" placeholder="Email address" required>
<label class="mautic-woo-subscribe-consent">
<input type="checkbox" name="consent" value="1"> I agree to marketing emails
</label>
<button type="submit">Subscribe</button>
<span class="mautic-woo-subscribe-result"></span>
</form>
The consent label and checkbox are only included when the consent attribute is provided with a non-empty value.
Styling
The shortcode enqueues two assets when the form is rendered:
mautic-woo-subscribe(JavaScript) – Handles the AJAX form submission.mautic-woo-subscribe(CSS) – Provides default styling for the form.
You can override the default styles in your theme by targeting the CSS classes: .mautic-woo-subscribe-form, .mautic-woo-subscribe-consent, and .mautic-woo-subscribe-result.
Form Capture
In addition to the shortcode, the plugin provides a Form Capture feature that can piggyback on any existing HTML form. To use it, add the data-mautic-woo attribute to any <form> element on your site. You can optionally add data-mautic-woo-tag="tagname" to apply a specific Mautic tag when the form is submitted.
<form action="/contact" method="post" data-mautic-woo data-mautic-woo-tag="lead">
<input type="email" name="email" placeholder="Email">
<button type="submit">Submit</button>
</form>
Form Capture requires the Form Capture option to be enabled in the Contact Sync settings tab. When enabled, the capture JavaScript is loaded on all frontend pages automatically.