Add a Custom Address Format

By default Listify uses the formats provided by WooCommerce to format an address based on the input country. If you would like to add a custom format for a base country you can use the following code: 

Do not put this code in the parent Listify theme’s functions.php. First create a child theme then add the code to the child theme’s functions.php file.
If you have existing code in your functions.php be sure to omit the first line (<?php) when adding the code to your file.

The available tags to use to construct the formatted address are:

  • {address_1} – The first line of the street address. Currently this contains the street number.
  • {address_2} – The second line of the street address.
  • {street_number} – Separate street number if {address_1} does not contain it or you need to change the position.
  • {postcode}
  • {city}
  • {state}
  • {state_code}
  • {country}
  • n – create a new line

Replace the ” DE” with the country code of the address that is being formatted. 

Was this article helpful?

Related Articles