Merge pull request #14436 from woocommerce/fix/14398

Fixes the shipping address map URL
This commit is contained in:
Mike Jolley 2017-04-17 11:12:19 +01:00 committed by GitHub
commit 9187f3cbb3
1 changed files with 10 additions and 1 deletions

View File

@ -765,7 +765,16 @@ class WC_Order extends WC_Abstract_Order {
* @return string
*/
public function get_shipping_address_map_url() {
$address = apply_filters( 'woocommerce_shipping_address_map_url_parts', $this->get_address( 'shipping' ), $this );
$address = $this->get_address( 'shipping' );
foreach ( array( 'first_name', 'last_name', 'company' ) as $key ) {
if ( isset( $address[ $key ] ) ) {
unset( $address[ $key ] );
}
}
$address = apply_filters( 'woocommerce_shipping_address_map_url_parts', $address, $this );
return apply_filters( 'woocommerce_shipping_address_map_url', 'https://maps.google.com/maps?&q=' . urlencode( implode( ', ', $address ) ) . '&z=16', $this );
}