Custom newsletter signup form

Solved
Highlighted
New Member
3 1 1

Hi there

 

Does adding:

 

<input type="hidden" name="customer[tags]" value="newsletter">

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.

 

TIA

Jamie

0 Likes
Highlighted
Excursionist
25 2 8

I think this is the info you're looking for:
https://help.shopify.com/en/themes/customization/forms/get-consent-for-promotional-emails

See step #5 specifically.

 

Hope that helps

0 Likes
Highlighted
New Member
3 1 1

This is an accepted solution.

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.

Highlighted
Shopify Partner
37 2 30

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:

 

<input type="text" name="contact[first_name]" placeholder="Enter your first name">
<input type="text" name="contact[last_name]"  placeholder="Enter your last name" >

 

 

Here's the customer account it created
Eric_Seastrand_0-1594247840123.png

0 Likes
Highlighted
New Member
2 0 0

I not finding any solution to add a phone number to the customer overview section. Anybody has solved this issue

0 Likes
Highlighted
Shopify Partner
37 2 30

That should be possible yes.

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

0 Likes