Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello!
Need a little help figuring out an error.
Backstory: In our store, we have three separate customers tags (retail, dentist, international) that we use to create four classifications of customers to differentiate product pricing/availability:
If customers have the international and the dentist tags then they can see our professional products priced for international sale - If they're domestic retail customers, they can order retail products priced for domestic sale - etc.
The problem: We've had the same registration form on our site for a while and all of a sudden, it's kicking back a "tags is invalid" error.
I've been able to figure out that the dentist vs retail and the international vs non-international tags work properly on their own but when it's trying to add both the dentist and the international tag, it does not work.
Note: the store is on the Supply 2.0.6 theme. (I know it's a vintage theme, we're working towards switching over, but I wanted to see if we can fix this with what we have right now)
Here's our code:
<div class="grid">
<div class="grid-item large--one-third push--large--one-third text-center">
<h1>{{ 'customer.register.title' | t }}</h1>
{% form 'create_customer' %}
{% include 'form-errors-custom' %}
<label for="first_name" class="hidden-label">{{ 'customer.register.first_name' | t }}</label>
<input type="text" value="" name="customer[first_name]" id="first_name" placeholder="{{ 'customer.register.first_name' | t }}" {% if form.errors contains "first_name" %} class="error"{% endif %} autofocus>
<label for="last_name" class="hidden-label">{{ 'customer.register.last_name' | t }}</label>
<input type="text" value="" name="customer[last_name]" id="last_name" placeholder="{{ 'customer.register.last_name' | t }}" {% if form.errors contains "last_name" %} class="error"{% endif %}>
<label for="email" class="hidden-label">{{ 'customer.register.email' | t }}</label>
<input type="email" value="" name="customer[email]" id="email" placeholder="{{ 'customer.register.email' | t }}" {% if form.errors contains "email" %} class="error"{% endif %} autocorrect="off" autocapitalize="off">
<label for="password" class="hidden-label">{{ 'customer.register.password' | t }}</label>
<input type="password" value="" name="customer[password]" id="create_password" placeholder="{{ 'customer.register.password' | t }}" {% if form.errors contains "password" %} class="error"{% endif %}>
<div class='validation-gd'>
<div class='form-group' style="padding-bottom: 0.75em;">
<p>Password must be at least 5 characters. More is better!</p>
<input type="checkbox" name='customer[note][first_order]' value='Yes'>
<label>Click here if this is your first order with us</label>
</div>
<!-- HC - International customers - 12 Oct '17 -->
<div class="form-group">
<label>Will the default shipping address be located outside the USA? (If shipping to US territories answer "no" to this question.)</label>
<select id="international_customer" name='customer[note][international]' required>
<option selected="selected" disabled="disabled" value="">Please Select One</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
<!-- End HC - 12 Oct '17 -->
<div class='form-group'>
<label>Are you buying for a dental or medical office?</label>
<select id='dental_or_medical' name='customer[note][dental_or_medical]' required>
<option selected="selected" disabled="disabled" value="">Please Select One</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<p>If “No”, please proceed to the “CREATE” button below.</p>
</div>
<div id="usa-yes" class='form-group' style="display: none;">
<label>Please enter the State and License # for the Doctor.</label>
<input id='not-required-license' type="text" name='customer[note][License]' value='' disabled>
</div>
<div id="dental-yes" class='form-group' style="display: none;">
<label>If you are a medical or dental professional please enter your designation.(e.g. DMD, DDS, RDH, etc.)</label>
<input type="text" name='customer[note][designation]' value=''>
</div>
</div>
<div id="append_dentistinfo">
<input id=“customer_tag” type="hidden" name="customer[tags][tag-1]" value="" />
</div>
<div id="append_inter">
<input id="tag_inter" type="hidden" name="customer[tags][tag-2]" value="" />
</div>
<p>
<input id='submit-register-form' type="submit" value="{{ 'customer.register.submit' | t }}" class="btn">
<input type="hidden" name="home_url" value="/" />
</p>
{{ 'customer.register.or' | t }} <a href="{{ shop.url }}">{{ 'customer.register.cancel' | t }}</a>
{% endform %}
</div>
</div>
<script>
$(document).ready(function(){
$('#dental_or_medical').change(function(){
if($(this).val()==='no'){
$('#not-required-license').removeAttr('required');
$('#not-required-license').attr('disabled','disabled');
/* HC - DentistReatil fix - 10 Nov '17 */
$('#tag_dentistof').val('Retail');
}else{
$('#tag_dentistof').val('Dentist');
$('#not-required-license').attr('required','required');
$('#not-required-license').removeAttr('disabled');
}
});
$("#create_customer").submit(function(e){
var value = $('#dental_or_medical').val();
if(value===''){
alert('Please Select One');
e.preventDefault();
}
else if(value==='no'){
}else{
var valgd = $('#not-required-license').val().trim();
if(valgd === '' || valgd === undefined){
alert('Please enter License');
e.preventDefault();
}
}
});
});
</script>
<!-- HC - International customers tag logic - 12 Oct '17 -->
<script>
$(document).ready(function(){
if ($('#international_customer').val() == 'yes') {
$('#tag_inter').val('International');
}
else {
$('#tag_inter').val('');
}
});
$('#international_customer').on('change', function(){
if ($('#international_customer').val() == 'yes') {
$('#tag_inter').val('International');
}
else {
$('#tag_inter').val('');
}
});
/* HC - Select behavior changes - 02 Nov '17 */
$('#dental_or_medical').on('change', function(){
if ($('#dental_or_medical').val() == 'yes') {
$('#usa-yes').css("display", "block");
$('#dental-yes').css("display", "block");
}
else {
$('#usa-yes').css("display", "none");
$('#dental-yes').css("display", "none");
}
});
</script>
Any ideas?
I've been staring at this for a while and I just feel like I'm missing something.
Thanks!
Same issue,
my customers are unable to register. Any workaround or fix?
I'm having the same issue, Registration form now comes up with an error message
Tags is Invalid
The relevant line in the form code is
<input type="text" name="customer[tags][Visibility]" value="visible-member"/>
This all used to work just fine.
Does anyone have an answer to this?
The right html tag for the hidden input to pass tags to the created customer is
<input type="hidden" name="contact[tags]" value="TEST_TAG, TEST-2_TAG, ANYOTHERRTAG">
I can’t speak to this specific issue yet, but if you need a workaround, Helium Customer Fields supports automatic and/or conditional customer tags during customer registration.
Since you're showing different prices based on customer tag, you might also be interested in our account approval feature.
The right html tag for the hidden input to pass tags to the created customer is
<input type="hidden" name="contact[tags]" value="TEST_TAG, TEST-2_TAG, ANYOTHERRTAG">
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024