Email consent
Customers can consent to email marketing through the theme using a newsletter sign-up form.
You can add a newsletter sign-up form to your theme with the Liquid form tag and accompanying 'customer' parameter. Inside the form, you need to include an input with the following attributes:
| Attribute | Value |
|---|---|
type | email |
name | contact[email] |
For example:
{% form 'customer' %}
<div className="email">
<label for="email">Email</label>
<input type="email" name="contact[email]" />
</div>
<div className="submit">
<input type="submit" value="Sign up" />
</div>
{% endform %}
When a customer signs up through this form, a customer will be created with the entered email, and the accepts_marketing attribute of the associated customer object will be set to true.
Tip
For another example of a newsletter sign-up form, you can refer to Dawn's implementation.
Tip:
For another example of a newsletter sign-up form, you can refer to Dawn's implementation.
Was this page helpful?