woocommerce_form_field and hidden fields

前端 未结 5 679
[愿得一人]
[愿得一人] 2021-01-14 17:18

I\'m trying to add custom fields to the WooCommerce checkout and there seems to be no output for hidden fields.

In woocommerce-template.php, hidden fie

5条回答
  •  终归单人心
    2021-01-14 17:34

    You have to pass the parameters when you add your filter.. Something like

    The third parameter in add_filter function is the numbers of parameter that the filter receive.

    The last parameter is the priority...

    add_filter('woocommerce_form_field_hidden', 'my_form_field_hidden', 4 , 15);
    

    Now you have to set the paramteres in the filter function.

    if ( ! function_exists('my_form_field_hidden') ) {
    
        function hp_form_field_hidden($no_parameter, $key, $args, $value) {
    
            $field = '

    ' . $after; return $field; } }

    I hope it helps

提交回复
热议问题