Skip to content

Instantly share code, notes, and snippets.

@j7u7l7s
Created November 6, 2018 21:29
Show Gist options
  • Save j7u7l7s/ec918c598cdffe49b10ac21f0bc294a3 to your computer and use it in GitHub Desktop.
Save j7u7l7s/ec918c598cdffe49b10ac21f0bc294a3 to your computer and use it in GitHub Desktop.
Liquid to add tags to new customer on creation + create a new tag with the company name field prefixed with 'company_'
<div id="company_name_field" class="clearfix large_form">
<label for="company_name" class="login">
Trading / Store Name - to appear on invoices and our store locator *
</label>
<input type="text" value="" name="customer[note][Company Name]" id="company_name" class="large" size="30" required />
</div>
<input type="hidden" id="processed_prospect_and_company_name" name="customer[tags]" value="Prospect"/>
<script type="text/javascript">
$(document).on('ready', function() {
$('#company_name').on('blur', function() {
var companyName = $('#company_name').val().replace(/[.,\/#!$%'\^&\*;:{}=\-_`~()]/g,"");
$('#processed_prospect_and_company_name').val('Prospect, company_' + companyName);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment