Create custom field into tag of attributes in woocommerce with add_action


I want to create a custom field into the terms of attributes in woocommerce, with add_action(), I have did search on the web but I can’t found any hooks in this place.

Here where I want to add my custom field :

Woocommerce / Attributes / Configures Terms / Edit term

Have you an idea of which hooks I can use here for add my custom field ? And another hooks to check the custom field after the form are post ?

Here a screenshot where I want my custom field :

enter image description here

Here the code that I want tu use (I just need the correct hook (hook1 & hook2) :

function custom_field_categorie($term)
    $term_id = $term->term_id;
    $args = array
        'id' => 'GRE_ID',
        'label' => __('ID genre'),
        'class' => '',
        'desc_tip' => true,
        'value' => get_term_meta($term_id, 'GRE_ID', true),
        'custom_attributes' => array('readonly' => 'readonly'),
add_action('hook1', 'custom_field_categorie', 10, 1);

function custom_field_categorie_save($term_id)
        update_term_meta($term_id, 'GRE_ID', sanitize_text_field($_POST['GRE_ID']));
add_action('hook2', 'custom_field_categorie_save', 10, 1);

Thanks for your help

Florian Richard 5 months 2021-06-28T02:24:54-05:00 0 Answers 0 views 0

Leave an answer