codeless.co

How to change order of Product Review Form fields in WooCommerce - Premium WordPress Themes, Plugins & Tutorials | Codeless

How to change order of Product Review Form fields in WooCommerce - Premium WordPress Themes, Plugins & Tutorials | Codeless

Today, I will show you a small snippet on how to change the order of WooCommerce Review form fields. In this large online stores industries, several times we need to change the basic WooCommerce fields order or something else that can fit our business model. For example, in my personal experience, i have changed the order of review form fields in a single product page on WooCommerce. By default, first is shown the Review Message field and then the User Name and Email Fields, like in image:

Now, sometime we need to position the “Your Review” field after “Name” and “Email” fields. For doing so, just copy and paste this code in your functions.php file on Main Theme or Child Theme

add_filter( 'comment_form_fields', 'codeless_woo_comment_form_fields', 9 ); function codeless_woo_comment_form_fields( $fields ){ if( function_exists('is_product') && is_product() ){ $comment_field = $fields['comment']; unset( $fields['comment'] ); $fields['comment'] = $comment_field; } return $fields; }

We highly recommend you to use a premium WordPress Theme when you create a professional online store with WooCommerce. Our suggestion is to use June Theme. It’s professional, beautiful, awesome UX to make your online store converts more and the most important, awesome support by a specialized team ( Codeless Team ).

Via https://codeless.co/how-to-change-order-of-product-review-form-fields-in-woocommerce/