If you want to add more custom fields for the Quote Form. You can add this code to your functions.php child theme on the backend.
add_action( 'wpc_quote_form_field_before_message', 'wpc_quote_form_field_before_message' );
function wpc_quote_form_field_before_message() {
?>
<div class="wpc-field-group">
<input type="text" name="wpc-country" value="" placeholder="<?php esc_html_e( 'Country', 'textdomain' ); ?>">
<span class="error" data-notice-country="true"></span>
</div>
<?php
}
add_filter( 'wpc_quote_form_mail_post_values', 'wpc_quote_form_mail_post_values' );
function wpc_quote_form_mail_post_values( $values ) {
$values['country'] = isset( $_POST['wpc-country'] ) ? $_POST['wpc-country'] : '';
return $values;
}
add_action( 'wpc_quote_form_field_validation', 'wpc_quote_form_field_validation', 10, 2 );
function wpc_quote_form_field_validation( $values, $errors ) {
if ( empty( $values['country'] ) ) {
$errors->add( 'country', esc_html__( 'Country field is empty.', 'textdomain' ) );
}
}
add_action( 'wp_footer', 'wpc_wp_footer', 10, 2 );
function wpc_wp_footer() {
?>
<script>
(function($){
$(document).ready(function ($) {
wpc.add_action(
'wpc_quote_form_field_error_notice',
function ($form, errorData) {
if (errorData.country) {
$form
.find('[data-notice-country]')
.text(errorData.country[0]);
}
}
);
});
})(jQuery);
</script>
<?php
}