Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin-email): format address elements in the correct order #2790

Closed
mathetos opened this issue Feb 8, 2018 · 3 comments
Closed

fix(admin-email): format address elements in the correct order #2790

mathetos opened this issue Feb 8, 2018 · 3 comments
Assignees

Comments

@mathetos
Copy link
Member

mathetos commented Feb 8, 2018

Issue Overview

See issue here:
image

This address should instead be formatted as so:
Billing Address:
123
SD, CA 92101
US

Or:
{street_address}
{city}, {state} {postal_code}
{country}

If there are other formats for other countries, we should take that into account as well, but this one is clearly wrong for the majority of our users in the US.

@kevinwhoffman kevinwhoffman changed the title {billing_address} enters the ZIP in between city and state, which is incorrect for US fix(email): format address elements in the correct order Feb 8, 2018
@ravinderk
Copy link
Collaborator

ravinderk commented Feb 9, 2018

@mathetos An address filter makes sense to me in core means different countries have different address format.

For example:

      /**
	 * Get formatted address.
	 *
	 * @return string Formatted address.
	 */
	function get_formatted_address( $address = array(), $args = array() ) {
                // code: set default address.

                $address_format = apply_filters( 'give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}", $args)

                // code: use str_replace to update address tag values.

		return apply_filter( 'give_get_fomatted_address', $address, $address_format, $address );
	}

User request: 89f785e

@mathetos
Copy link
Member Author

mathetos commented Feb 9, 2018

@ravinderk I agree that a filter is useful for this. But the default should be what I outlined above, not what it currently is.

@mathetos
Copy link
Member Author

mathetos commented Feb 9, 2018

@ravinderk Apologies, i didn't look closely at your code example. That format looks great.

@kevinwhoffman kevinwhoffman changed the title fix(email): format address elements in the correct order fix(admin-email): format address elements in the correct order Feb 21, 2018
@ravinderk ravinderk added this to the 2.0.5 milestone Feb 26, 2018
@ravinderk ravinderk assigned ravinderk and unassigned Sidsector9 Feb 26, 2018
@ravinderk ravinderk modified the milestones: 2.0.5, 2.1 Feb 26, 2018
@DevinWalker DevinWalker removed this from the 2.1 milestone Mar 6, 2018
@DevinWalker DevinWalker assigned jaydeeprami and unassigned ravinderk Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants