WC_Checkout::set_customer_address_fields()
Set address field for customer.
Метод класса: WC_Checkout{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->set_customer_address_fields( $field, $key, $data );
- $field(строка) (обязательный)
- String to update.
- $key(строка) (обязательный)
- Field key.
- $data(массив) (обязательный)
- Array of data to get the value from.
Список изменений
С версии 3.0.7 | Введена. |
Код WC_Checkout::set_customer_address_fields() WC Checkout::set customer address fields WC 9.8.1
protected function set_customer_address_fields( $field, $key, $data ) { $billing_value = null; $shipping_value = null; if ( isset( $data[ "billing_{$field}" ] ) && is_callable( array( WC()->customer, "set_billing_{$field}" ) ) ) { $billing_value = $data[ "billing_{$field}" ]; $shipping_value = $data[ "billing_{$field}" ]; } if ( isset( $data[ "shipping_{$field}" ] ) && is_callable( array( WC()->customer, "set_shipping_{$field}" ) ) ) { $shipping_value = $data[ "shipping_{$field}" ]; } if ( ! is_null( $billing_value ) && is_callable( array( WC()->customer, "set_billing_{$field}" ) ) ) { WC()->customer->{"set_billing_{$field}"}( $billing_value ); } if ( ! is_null( $shipping_value ) && is_callable( array( WC()->customer, "set_shipping_{$field}" ) ) ) { WC()->customer->{"set_shipping_{$field}"}( $shipping_value ); } }