I have created a form for people to subscribe to my newsletter and i would like to classify them by getting their gender and size (i’m in the garment industry). So i need to create tags.
I achieved to create the tag "newsletter", which will be the same for everyone subscribing.
Now I need to get both the size and gender on text field input and know it must be:
" (newletter, something(size), something(gender)) "
Here is the code for the contact[tags]:
{%- form "customer", class: "subscribe-form-flex" -%}<input type="hidden" name="contact[tags]" value="newsletter, ">
For the size:
<input type="hidden" class="text-field-6 desktop w-input" maxlength="256" name="size_" data-name="Size 2" placeholder="" id="Size" value="Size" >
For the Gender:
<input type="hidden" class="text-field-7 desktop w-input" maxlength="256" name="gender_" data-name="Gender 2" placeholder="" id="Gender" required="" value="Gender">
My text field IDs are then:
Size
Gender
Any idea, someone ?
Thank you in advance !
2
Answers
There are probably other solutions, but what I have done to solve a similar problem is
So in practice you have your form with your inputs (I have added just the size) and then, before you submit the form, you modify the tag input to have all the tags you need.
I don’t know your level of Javascript, let me know if you need more details.
For a Shopify store that doesn’t use JQuery, you can use the below code.
Firstly create a hidden input with the
name="contact[tags]"
to point it at the Shopify tags field.Get all of your inputs and concatenate them using comma separation which will send these as separate tags.