ethercreative/mailchimp-commerce

Opt-in during checkout

Closed this issue · 2 comments

I know I'm missing something simple, but I cannot get the opt-in lightswitch to turn on during checkout. I have a custom field subscribeToNewsletter that defaults to off and has been added to my order fields. In my templates, I ask for the user to opt-in when they enter their email address. My template code is as follows:

<form method="post">
  <input type="hidden" name="action" value="commerce/cart/update-cart">
  {{ csrfInput() }}

  <label for="email">E-mail</label>
  <input id="email" type="email" value="{{ cart.email }}" name="email">

<label>
  <input type="checkbox" name="fields[subscribeToNewsletter]" value="1" checked>
  Subscribe to updates, promotions and news.
</label>

  <button type="submit">Confirm E-mail</button>
</form>

Thanks in advance for some guidance.

Ugh. Typo in my field handle in the field settings.

@johnj24 Glad you figured it out!