Automattic\WooCommerce\Blocks\Domain\Services
CheckoutFieldsAdmin::admin_address_fields()
Injects address fields in WC admin orders screen.
Метод класса: CheckoutFieldsAdmin{}
Хуков нет.
Возвращает
Массив
.
Использование
$CheckoutFieldsAdmin = new CheckoutFieldsAdmin(); $CheckoutFieldsAdmin->admin_address_fields( $fields, $order, $context );
- $fields(массив) (обязательный)
- The fields to show.
- $order(\WC_Order|true|false)
- The order to show the fields for.
По умолчанию: null - $context(строка)
- The context to show the fields for.
По умолчанию: 'edit'
Код CheckoutFieldsAdmin::admin_address_fields() CheckoutFieldsAdmin::admin address fields WC 9.6.0
public function admin_address_fields( $fields, $order = null, $context = 'edit' ) { if ( ! $order instanceof \WC_Order ) { return $fields; } $group_name = doing_action( 'woocommerce_admin_billing_fields' ) ? 'billing' : 'shipping'; $additional_fields = $this->checkout_fields_controller->get_order_additional_fields_with_values( $order, 'address', $group_name, $context ); foreach ( $additional_fields as $key => $field ) { $prefixed_key = CheckoutFields::get_group_key( $group_name ) . $key; $additional_fields[ $key ] = $this->format_field_for_meta_box( $field, $prefixed_key ); } array_splice( $fields, array_search( 'state', array_keys( $fields ), true ) + 1, 0, $additional_fields ); return $fields; }