WooCommerce: Add additional form field attributes to WC Vendors Pro

Rate this post

Apologies if I use some of the wrong terminology in my question. I am self-taught and still learning. The code below is part of a form template. I would like to add some additional attributes to the array.

I am wondering how I can do that without clearing the existing attributes of the template?

I’d like to keep the additional attributes on my child theme’s functions.php file.

Here is the related plugin function that I would like to alter:

 *  Output product title
 * @since    1.0.0
 * @param     int $post_id post_id for this meta if any
public static function title($post_id, $product_title) {

                'post_id'           => $post_id,
                'id'                => 'post_title',
                'label'             => __( 'Product name', 'wcvendors-pro' ),
                'value'             => $product_title,
                'custom_attributes' => array(
                    'required'                   => '',
                    'data-parsley-maxlength'     => '100',
                    'data-parsley-error-message' => __( 'Product name is required or too long.', 'wcvendors-pro' ),

Here is what I would like to add:

'placeholder' => __( 'Here is some placeholder text', 'wcvendors-pro' ),
'desc_tip'    => 'true',
'description' => __( 'Here is some description text.', 'wcvendors-pro' ),



Try the following as there is a filter hook:

add_filter( 'wcv_product_title', 'customize_wcv_form_field' );
function customize_wcv_form_field( $args ) {
    $more_args = array(
        'placeholder' => __( 'Here is some placeholder text', 'wcvendors-pro' ),
        'desc_tip'    => 'true',
        'description' => __( 'Here is some description text.', 'wcvendors-pro' ),
    return array_merge( $args, $more_args);

Code goes in functions.php file of the active child theme (or active theme). It should work.

Leave a Reply

Your email address will not be published.

Back to top button