Question

I need to add additional fields to a Woocommerce product rating system like this: enter image description here

I opened this file: /wp-content/plugins/woocommerce/templates/single-product-reviews.php and saw the following lines:

$comment_form = array(
        'title_reply' => $title_reply,
        'comment_notes_before' => '',
        'comment_notes_after' => '',
        'fields' => array(
            'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . '</label> ' . '<span class="required">*</span>' .
                        '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" /></p>',
            'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . '</label> ' . '<span class="required">*</span>' .
                        '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-required="true" /></p>',
        ),
        'label_submit' => __( 'Submit Review', 'woocommerce' ),
        'logged_in_as' => '',
        'comment_field' => ''
    );

and this

$comment_form['comment_field'] = '<p class="comment-form-rating"><label for="rating">' . __( 'Rating', 'woocommerce' ) .'</label><select name="rating" id="rating">
            <option value="">'.__( 'Rate&hellip;', 'woocommerce' ).'</option>
            <option value="5">'.__( 'Perfect', 'woocommerce' ).'</option>
            <option value="4">'.__( 'Good', 'woocommerce' ).'</option>
            <option value="3">'.__( 'Average', 'woocommerce' ).'</option>
            <option value="2">'.__( 'Not that bad', 'woocommerce' ).'</option>
            <option value="1">'.__( 'Very Poor', 'woocommerce' ).'</option>
        </select></p>';

Is there any way I can add another select inputs?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top