to the “customer” form, magically make those customers appear in the “Accepts Marketing” section of the admin, or do I need to add accepts_marketing as a hidden field with value true?
In the examples of newsletter forms I’ve seen, including the official starter theme, there is just a tag of newsletter. The theme I’m working on doesn’t use sections, if that makes any difference.
For anyone else stumbling on this post, it seems that “Accepts marketing” is set by default just by using this form type:
{% form 'customer' %}
It would be useful if this was documented along with the fact that you need to use “contact” and not “customer” field names with this form. The documentation could be improved further by explaining what happens when the customer is already added. For that it seems, the behaviour is to just reload the page with the parameters in the URL and supply no form errors.
To expand on ib3’s comments: it seems you can add any arbitrary customer field to the form and it gets saved in the customer record. For example, if you wanted to add inputs for first and last name to the newsletter form, you could do that with HTML like this:
Admittedly, I’m not quite sure what you mean by the “customer overview” section. Is this when creating the account? In a newsletter form? Customer edit page?
It’s best if you can upload a screenshot of where you want this to show up, and include the URL bar in the screenshot. A link to your actual store would be even better.
In any case, I’d bet that the solution described in my forum post above will work. Have you tried that already? If so, screenshot your Liquid so we can see what didn’t work and advise accordingly. We’re all learning this stuff together
I haven’t tried yet with the Dawn theme, but it should work exactly the same way. Just add an input with a name like:
name="contact[first_name]"
I say should because the handling of those form inputs is all handled server-side, independently of what theme you’re using. I guess it’s possible the handling is different for Dawn vs Debut, but that seems highly unlikely.
In any case, let us know if you end up trying it / whether it worked or not.
Hi, I tired to put this html into an existing page and it would not take…just stayed as html code. what am I doing wrong? I have the checkbox on the cart but I wanted to put the sign up to newsletter in my blog and on a couple of other pages. I use the Supply theme. Thanks for any help that you can offer!