Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -454,18 +454,27 @@ class WC_Customer extends WC_Legacy_Customer {
*
* @since 3.0.0
* @param string $prop Name of prop to get.
* @param string $address billing or shipping.
* @param string $context What the value is for. Valid values are 'view' and 'edit'. What the value is for. Valid values are view and edit.
* @param string $address_type Type of address; 'billing' or 'shipping'.
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return mixed
*/
protected function get_address_prop( $prop, $address = 'billing', $context = 'view' ) {
protected function get_address_prop( $prop, $address_type = 'billing', $context = 'view' ) {
$value = null;
if ( array_key_exists( $prop, $this->data[ $address ] ) ) {
$value = isset( $this->changes[ $address ][ $prop ] ) ? $this->changes[ $address ][ $prop ] : $this->data[ $address ][ $prop ];
if ( array_key_exists( $prop, $this->data[ $address_type ] ) ) {
$value = isset( $this->changes[ $address_type ][ $prop ] ) ? $this->changes[ $address_type ][ $prop ] : $this->data[ $address_type ][ $prop ];
if ( 'view' === $context ) {
$value = apply_filters( $this->get_hook_prefix() . $address . '_' . $prop, $value, $this );
/**
* Filter: 'woocommerce_customer_get_[billing|shipping]_[prop]'
*
* Allow developers to change the returned value for any customer address property.
*
* @since 3.6.0
* @param string $value The address property value.
* @param WC_Customer $customer The customer object being read.
*/
$value = apply_filters( $this->get_hook_prefix() . $address_type . '_' . $prop, $value, $this );
}
}
return $value;
@@ -920,18 +929,18 @@ class WC_Customer extends WC_Legacy_Customer {
* Sets a prop for a setter method.
*
* @since 3.0.0
* @param string $prop Name of prop to set.
* @param string $address Name of address to set. billing or shipping.
* @param mixed $value Value of the prop.
* @param string $prop Name of prop to set.
* @param string $address_type Type of address; 'billing' or 'shipping'.
* @param mixed $value Value of the prop.
*/
protected function set_address_prop( $prop, $address, $value ) {
if ( array_key_exists( $prop, $this->data[ $address ] ) ) {
protected function set_address_prop( $prop, $address_type, $value ) {
if ( array_key_exists( $prop, $this->data[ $address_type ] ) ) {
if ( true === $this->object_read ) {
if ( $value !== $this->data[ $address ][ $prop ] || ( isset( $this->changes[ $address ] ) && array_key_exists( $prop, $this->changes[ $address ] ) ) ) {
$this->changes[ $address ][ $prop ] = $value;
if ( $value !== $this->data[ $address_type ][ $prop ] || ( isset( $this->changes[ $address_type ] ) && array_key_exists( $prop, $this->changes[ $address_type ] ) ) ) {
$this->changes[ $address_type ][ $prop ] = $value;
}
} else {
$this->data[ $address ][ $prop ] = $value;
$this->data[ $address_type ][ $prop ] = $value;
}
}
}