Fix #24365: Prevent billing address from being updated on shipping update. (#24374)

* Prevent billing address from being updated on shipping update.

* Set billing address if empty.

* Fix coding standard issue.

* Fixed missing tab
This commit is contained in:
Juancho Pestana 2019-12-05 16:17:01 -08:00 committed by Claudio Sanches
parent 6bdb7f7a83
commit b8217fa080
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ class WC_Shortcode_Cart {
}
if ( $address['country'] ) {
WC()->customer->set_billing_location( $address['country'], $address['state'], $address['postcode'], $address['city'] );
if ( ! WC()->customer->get_billing_first_name() ) {
WC()->customer->set_billing_location( $address['country'], $address['state'], $address['postcode'], $address['city'] );
}
WC()->customer->set_shipping_location( $address['country'], $address['state'], $address['postcode'], $address['city'] );
} else {
WC()->customer->set_billing_address_to_base();