1

I need to update default address layout which used in order, invoice and emails. So that I change the layout in store->configuration->customer->customer configuration->address template.

I need to display house number after the Street Name. I created address attribute named as house_no. house_no value is available but is not showing email or PDF

this is the deafult

{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}{{depend firstname}}<br/>{{/depend}}
{{depend company}}{{var company}}<br />{{/depend}}
{{if street1}}{{var street1}}<br />{{/if}}
{{depend street2}}{{var street2}}<br />{{/depend}}
{{depend street3}}{{var street3}}<br />{{/depend}}
{{depend street4}}{{var street4}}<br />{{/depend}}
{{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}<br/>
{{var country}}<br/>
{{depend telephone}}T: {{var telephone}}{{/depend}}
{{depend fax}}<br/>F: {{var fax}}{{/depend}}
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}

After the modification code

{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}{{depend firstname}}<br/>{{/depend}}
{{depend company}}{{var company}}<br />{{/depend}}
{{if street1}}{{var street1}}<br />{{/if}}
{{depend street2}}{{var street2}}<br />{{/depend}}
{{depend street3}}{{var street3}}<br />{{/depend}}
{{depend street4}}{{var street4}}<br />{{/depend}}
{{depend house_no}}<br/> {{var house_no}}{{/depend}}
{{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}<br/>
{{var country}}<br/>
{{depend telephone}}T: {{var telephone}}{{/depend}}
{{depend fax}}<br/>F: {{var fax}}{{/depend}}
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}

enter image description here

Please help me what is the wrong in there ?

8
  • You just removed this line {{depend house_number_appendix}}<br/> {{var house_number_appendix}}{{/depend}} in your modified code, anything alo changed, please let me know, are you getting any error please share ? – Vibhore Jain May 12 at 3:44
  • it was a mistake default code not containing house_no or house_number_appendix. I will update the question. any error not visible . i will attached screenshot also – Singhe May 12 at 3:51
  • If you have access to database related tables .. then see - customer_address_entity table is also not having house number or house number appendix. Please check at your side. and in address.phtml file in your vendor/magento folder - /app/design/frontend/Raptor/Desktop/Magento_Customer/templates/account/dashboard/address.phtml (this is my overridden path). We may need to create another table to hold extra information. I have customer_address_entity_extra_info and with inner join i am using but i don't know if the same case will work for you. Better to search if magento gives to add house number – Vibhore Jain May 12 at 4:03
  • Is these fields(house no and house no_appendix) in your form where customer is adding his address ? Are they storing properly which table or field please check with database also. This tutorial may be helpful - devdocs.magento.com/guides/v2.4/howdoi/checkout/… – Vibhore Jain May 12 at 4:05
  • house_no saved into database. when click edit button house no field is fill. but unfortunately HTML address template not rending as I wish – Singhe May 12 at 4:23
0

This tutorial will teach us to add the extra field in address form.
https://www.fmeextensions.com/blog/add-custom-field-magento-2-shipping-address/
Please try the solution given here to add the fields house_no and house_number_appendix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.