WC_Checkout::get_checkout_fields PHP Method

get_checkout_fields() public method

Get an array of checkout fields.
public get_checkout_fields ( string $fieldset = '' ) : array
$fieldset string to get.
return array
    public function get_checkout_fields($fieldset = '')
    {
        if (is_null($this->fields)) {
            $this->fields = array('billing' => WC()->countries->get_address_fields($this->get_value('billing_country'), 'billing_'), 'shipping' => WC()->countries->get_address_fields($this->get_value('shipping_country'), 'shipping_'), 'account' => array(), 'order' => array('order_comments' => array('type' => 'textarea', 'class' => array('notes'), 'label' => __('Order notes', 'woocommerce'), 'placeholder' => esc_attr__('Notes about your order, e.g. special notes for delivery.', 'woocommerce'))));
            if ('no' === get_option('woocommerce_registration_generate_username')) {
                $this->fields['account']['account_username'] = array('type' => 'text', 'label' => __('Account username', 'woocommerce'), 'required' => true, 'placeholder' => esc_attr__('Username', 'woocommerce'), 'autocomplete' => 'username');
            }
            if ('no' === get_option('woocommerce_registration_generate_password')) {
                $this->fields['account']['account_password'] = array('type' => 'password', 'label' => __('Account password', 'woocommerce'), 'required' => true, 'placeholder' => esc_attr__('Password', 'woocommerce'), 'autocomplete' => 'password');
            }
            $this->fields = apply_filters('woocommerce_checkout_fields', $this->fields);
        }
        if ($fieldset) {
            return $this->fields[$fieldset];
        } else {
            return $this->fields;
        }
    }