Rafa Acioly
Rafa Acioly

Reputation: 636

How to add a text field on woocommerce integrations tab settings?

How can I add a new text field on the integrations tab of woocommerce settings? I've managed to add on the general tab;

function add_token_input($settings)
{
    $updated_settings = [];

    foreach ($settings as $section) {
        if (
            isset($section['id']) && 'general_options' == $section['id'] &&
            isset($section['type']) && 'sectionend' == $section['type']
        ) {
            $updated_settings[] = [
                'name' => __('Token ', 'wc_seq_order_numbers'),
                'desc_tip' => __('Place your request token', 'wc_seq_order_numbers'),
                'id' => 'my-plugin-name',
                'type' => 'password',
                'css' => 'min-width:300px;',
                'std' => '',  // WC < 2.0
                'default' => '',  // WC >= 2.0
                'desc' => __('Exemplo: b4e58140b61cf086c82153f6c371668684f6ca71'),
            ];
        }

        $updated_settings[] = $section;
    }

    return $updated_settings;
}
add_action("woocommerce_general_settings", 'add_token_input');

I've also tried to use woocommerce_integration_settings and woocommerce_get_settings_integrations but none of them worked.

Upvotes: 0

Views: 22

Answers (0)

Related Questions