Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
Getting Shipping Address from WooCommerce Checkout Page?

i'm a little bit stuck.

I've figured out how to retrieve the addresses assigned to a customers profile via the follow:

print_r(WC()->customer);

But I can't for the life of me figure out what the hook or whichever is required in order to get the shipping address that is being used for the calculation of shipping on the order checkout page.

My question is:

Is this something that is possible to get?

Thank you for the help!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There are several ways to get the shipping address.

One solution using global $woocommerce:

global $woocommerce;
echo $woocommerce->customer->get_billing_address();
echo $woocommerce->customer->get_billing_city();
echo $woocommerce->customer->get_billing_state();

Another solution using global $current_user:

global $current_user;

$billing_address_1 = get_user_meta($current_user->ID, 'billing_address_1', true);
$billing_city = get_user_meta($current_user->ID, 'billing_city', true);
$billing_state = get_user_meta($current_user->ID, 'billing_state', true);

echo $billing_address_1;
echo $billing_city;
echo $billing_state;

Another solution using WC():

echo WC()->customer->get_billing_address_1();
echo WC()->customer->get_billing_city();
echo WC()->customer->get_billing_state();

Another solution using session:

$customer_data = WC()->session->get('customer');
echo $customer_data['address_1'];
echo $customer_data['city'];
echo $customer_data['state'];
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!