There are two ways that a customer can consent to email marketing through the theme: - [A newsletter sign-up form](#newsletter-sign-up-form) - [A checkbox input in the customer register form](#customer-registration-form-checkbox) ## Newsletter sign-up form You can add a newsletter sign-up form to your theme with the Liquid [form tag](/docs/api/liquid/tags/form#form-customer) and accompanying `'customer'` parameter. Inside the form, you need to include an input with the following attributes: <table> <thead> <tr> <th>Attribute</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td><code>type</code></td> <td><code>email</code></td> </tr> <tr> <td><code>name</code></td> <td><code>contact[email]</code></td> </tr> </tbody> </table> For example: ```liquid {% form 'customer' %} <div class="email"> <label for="email">Email</label> <input type="email" name="contact[email]" /> </div> <div class="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](/docs/api/liquid/objects/customer) will be set to `true`. > Tip: > For another example of a newsletter sign-up form, you can refer to [Dawn's implementation](https://github.com/Shopify/dawn/blob/main/sections/footer.liquid). ## Customer registration form checkbox Inside the [customer register form](/docs/storefronts/themes/architecture/templates/customers-register#the-customer-register-form), you can include a checkbox to allow customers to consent email marketing. This requires the following inputs to be placed inside the form: <table> <thead> <tr> <th>Input</th> <th>type</th> <th>name</th> </tr> </thead> <tbody> <tr> <td>Accepts marketing</td> <td><code>hidden</code></td> <td><code>customer[accepts_marketing]</code></td> </tr> <tr> <td>Accepts marketing</td> <td><code>checkbox</code></td> <td><code>customer[accepts_marketing]</code></td> </tr> </tbody> </table> For example: ```liquid {% form 'create_customer' %} {{ form.errors | default_errors }} <div class="first-name"> <label for="first-name">First name</label> <input type="text" name="customer[first_name]" /> </div> <div class="last-name"> <label for="last-name">Last name</label> <input type="text" name="customer[last_name]" /> </div> <div class="email"> <label for="email">Email</label> <input type="email" name="customer[email]" /> </div> <div class="password"> <label for="password">Password</label> <input type="password" name="customer[password]" /> </div> <div class="accepts-marketing"> <input type="hidden" name="customer[accepts_marketing]" value="false" /> <input type="checkbox" name="customer[accepts_marketing]" /> <label for="accepts-marketing">Subscribe to email marketing</label> </div> <div class="submit"> <input type="submit" value="Create" /> </div> {% endform %} ``` > Tip: > This solution requires a hidden input, as well as the checkbox input, as an unchecked box won't record a value when the form is submitted.