The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Custom field for birth date

Hi, i would like to have a costum field for bith date, right below the tax id field, can you send me some sample code?

Also, it should be in this format: DD-MM-YYYY

  • fc_adamfc_adam FoxyCart Team

    For adding in a custom date field on the checkout, we have a snippet with details on that on our wiki here:

    As you're wanting it specifically to appear right before the "tax id" field though, those instructions won't completely apply to you. If you complete step 1 on that page in regards to getting the date picker library installed, you can then add the following code to the "footer" textarea of the "Add custom header and footer code to your templates" configuration option:
    {% if context == "checkout" %}
    FC.client.on('render.done', function() {
    if ($(".fc-address-entry__birth-date-container").length < 1) {
    var default_value = (FC.json.hasOwnProperty("birth_date")) ? FC.json.birth_date : "";
    $('div.fc-form-group.fc-address-entry__tax-id-container').after('<div class="fc-form-group fc-address-entry__birth-date-container"><label for="birth_date" class="fc-form-label fc-form-label--birth-date col-sm-3">Birth Date</label><div class="col-sm-8"><input type="text" id="birth_date" name="birth_date" value="' + default_value + '" placeholder="Birth Date (optional)" class="fc-form-control fc-form-control--birth-date"></div></div>');

    dateFormat: 'dd-mm-yy',
    onSelect: function() {
    $(this).trigger('focusout.fc', {validateNow: true});
    {% endif %}
    I hope that helps!
  • Thanks a lot!
Sign In or Register to comment.