woocommerce attribute terms – save custom field value

Can anyone help? I created a custom field on attribute term but don’t know why it is not saving after the term update. User has necessary permissions.

if (is_admin() && isset($_GET['taxonomy'], $_GET['post_type']) && $_GET['post_type'] === 'product') {

$taxonomy_name = sanitize_text_field($_GET['taxonomy']);


add_action($taxonomy_name . '_edit_form_fields', 'custom_edit_term_fields', 10, 2);

function custom_edit_term_fields($term, $taxonomy)
{

    $value = get_term_meta($term->term_id, 'custom-term-input', true);

    echo '<tr class="form-field">
<th>
    <label for="custom-term-input">Custom input</label>
</th>
<td>
    <input name="custom-term-input" id="custom-term-input" type="text" value="' . esc_attr($value) . '" />
    <p class="description">Description text</p>
</td>
</tr>';
}


add_action('created_' .  $taxonomy_name, 'custom_save_term_fields');
add_action('edited_' .  $taxonomy_name, 'custom_save_term_fields');

function custom_save_term_fields($term_id)
{

    update_term_meta(
        $term_id,
        'custom-term-input',
        sanitize_text_field($_POST['custom-term-input'])
    );
}
}