1
votes

I am displaying a shortened version of the customer's billing address before the billing fields on the checkout page.

function show_billing_summary_checkout(){
    global $woocommerce;
    //show short version
    echo '<b>Your Billing Address</b> <a href="">Change</a><br>';
    echo $woocommerce->customer->get_billing_company() . '<br>';
    echo $woocommerce->customer->get_billing_first_name() . " " . $woocommerce->customer->get_billing_last_name() . '<br>';
    echo $woocommerce->customer->get_billing_email()  . '<br>';
    echo $woocommerce->customer->get_billing_address_1() . '<br>';
    echo $woocommerce->customer->get_billing_city() . ', ' . $woocommerce->customer->get_billing_state() . ' ' . $woocommerce->customer->get_billing_postcode() .'<br>';
    echo $woocommerce->customer->get_billing_country() . '<br>';
    echo 'Phone: ' . $woocommerce->customer->get_billing_phone() . '<br>';

}
add_action('woocommerce_before_checkout_billing_form', 'show_billing_summary_checkout', 1);

It worked... but only once. By that I mean when I changed my billing info under the edit addresses page, it didn't change on the checkout page. All of the changes show up in the admin panel however, so something in this function isn't pulling the updated information to the checkout page. ALSO, the information didn't update in the editable billing fields on the checkout page either.

1

1 Answers

0
votes

I believe your problem will relate to Issue #16436 - Session data not being overwritten when it should be

https://github.com/woocommerce/woocommerce/issues/16436

I suggest you track this issue and test your function again once it has been resolved.