WooCommerce echo address Postcode/City from Login User

WooCommerce has a shipping address, that Customers fill shipping address form and saves on the database automatic, including postcode (zip code), city, and more. In this post, we share shortcodes for woocommerce, validator built-in which is used to find appropriate shipping methods on the checkout. How woocommerce echo address from login user current address pincode/city zip code echo.

$customer_id = get_current_user_id();

if ( ! wc_ship_to_billing_address_only() &amp;&amp; wc_shipping_enabled() ) {
	$get_addresses = apply_filters(
			'shipping' => __( 'Shipping address', 'woocommerce' ),


<?php foreach ( $get_addresses as $name => $address_title ) : ?>

		$address = wc_get_account_formatted_address( $name );

<?php endforeach; ?>


echo get_user_meta( $customer_id, $name . '_postcode', true )."<br>";
echo get_user_meta( $customer_id, $name . '_city', true );


In this code, they get only login user shipping address, postalcode or ZIP code, and city direct echo like (110001 and Delhi) all the shipping zone information that is a postcode and city.

That is done by providing the ‘customer_id’ as the object id and the ‘billing address’ as the object compare my account. Why? Because the results retrieved from the SQL above will provide you will an array of objects with those attributes.

Leave a Reply

Your email address will not be published. Required fields are marked *