How to enable company input field in checkout?

Hey!

In the email templates I can see, that there is a company in both address and billing address. However it is not asked for in the checkout process. How can I enable this field?

Thank you!

Hi @newnowtim, thanks for reaching out!

Can you show us which field do you see in the template?
You can add fields with customization, but I want to be sure we’re on the same page.

Thanks.

Hey!

Thanks for your quick response!

When I look at Email Templates → Invoice, for both addresses, there is a company variable:

...
{{ #with order.billingAddress }}
{{ fullName }}
<br />

{{ #if company }}
{{ company }}
<br />
{{ /if }}
...

So I was guessing there should already be a company field in the checkout form and a way to activate it, without going into customization.

@nelitow sorry to ping you directly, maybe you could take another look, I would really appreciate it. My client is asking for a solution and I would love to use a built in functionality instead of customization.

Hi @newnowtim,

The company field inside the email template will only be filled if you are using the v2 of snipcart as this information was collected in the checkout form.

Unfortunately, this isn’t the case for the v3 anymore and the only way to add it is through an order custom field.

Thank you, I have implemented it using a custom field.

Where does customFields reside in the email templates?
Is it order.customFields.myField or just customFields.myField?

It should be in the order.customFields property, so in your email template you could use something like this:

{{ #each order.customFields }}
    {{ #if_eq name 'myField' }}
        <!-- Your content here -->
    {{ /if_eq}}
{{ /each }}

This will show the content only for only the custom field with the name “myField”.

Let me know if that helps!

1 Like

Yeah, thanks a lot. I was not sure if customFields was top level or nested into order, but now I know :slight_smile:

I am sure it is going to work, will try soon. If it doesn’t, I will get back to you, thank you for your help!