I am trying to use a few custom fields in the Customer section
I created
CompanyName
AttentionTo
DeliveryAddress
numbered them 1,2,3
in my invoice I entered
to try and display the Delivery Address
I have tried all combinations of
custom_field.DeliveryAddress
customer.custom_field.DeliveryAddress
custom field[âDeliveryAddressâ]
etc etc
what is the syntax I need to use to allow the placing of custom codes into my HTML?
Thanks
Haydn
Specifics of HTML would depend on where you are trying to place this information in a form. What are you trying to accomplish? Because you can enter all that directly into the Address field for the customers when you define them. See the guide:
Read the portion about adding additional information. (Note that one example shows a delivery route custom field in the wrong place. That guide has not yet been updated for the recent theme changes. The concept is still valid, though.)
I have a couple of customers who run their own business at night but during the day work for someone else.
they want their stuff delivered to their day job business address not their billed to address.
so I created customer fields as above.
then inserted them into the invoice in the second column
Perfect Thanks.
I changed the section toâŚ
And Now I can Have my custom fields displaying where I want and looking like I want.
As I said if you have a seperate billing and delivery address this worked a treat, putting it all in the Customer address field was not what I wanted as you couldnât bold only certain lines.
Thanks For your Help
this Problem Resolved
<td>
<div style="font-size: 14px"><b>Deliver To:</b></div>
{% for field in custom_fields %}
{% if field.label != 'CompanyName' %}{% continue %}{% endif %}
<div><b>{{ field.text }}</b></div>
{% endfor %}
{% for field in custom_fields %}
{% if field.label != 'AttentionTo' %}{% continue %}{% endif %}
<div>Att: {{ field.text }}</div>
{% endfor %}
{% for field in custom_fields %}
{% if field.label != 'DeliveryAddress' %}{% continue %}{% endif %}
<div>{{ field.text | newline_to_br }}</div>
{% endfor %}
</td>
Yes, you can. Address fields will accept HTML. Just be aware as you check out the results that the changes are not retroactive. In other words, you cannot bold a line in the address and see it show up in an existing invoice. You must first edit that invoice by reselecting the customer. The change will be visible on all future invoices for that customer.
This seems a much simpler solution than writing code for entire new themes.