Wishlist - How to add a new field to Ask an Estimante popup

How to proceed to add a new field to Ask an Estimante popup
It is quite easy, and just requires a couple of steps

Before proceeding any further, make sure that you correctly enabled Ask an Estimate feature and Addiional informations popup



Then proceed as follows:

1. copy wishlist-view.php template from wp-content/plugins/yith-woocommerce-wishlist-premium/templates/ and paste it in wp-content/themes/<your theme or child folder>/woocommerce/ (you may need to create woocommerce subfolder)

2. open your brand new wishlist-view.php overridden template, and edit it to add all the input fields you need, before of after additional_notes textarea (line 309)



Then only important thing is that you place your additional input fields in the form tag
Just to give you an example, I'll add a name field before Additional notes textarea



3. If you've done previous steps properly, now you should be able to see your custom fields in the Additional Informations popup, when it opens



Anyway, these data won't still be sent within the email
In order to add Name field to content, you'll need to add the following snippet of code at the end of functions.php file of your theme or child

if( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_custom_ask_an_estiamte_fields' ) ){
function yith_wcwl_custom_ask_an_estiamte_fields( $fields, $posted, $mail ){
if( isset( $posted['name'] ) ){
$fields['name'] = sanitize_text_field( $posted['name'] );
}

return $fields;
}
add_filter( 'yith_wcwl_estimate_additional_data', 'yith_wcwl_custom_ask_an_estiamte_fields', 10, 3 );
}

Please, note that the section of code that I hihglighted actually add name field between additional data



you can repeat that section for any field you want to add to email content, simply changing name of the field

Was this article helpful?
0 out of 0 found this helpful

Back to Help Center

Powered by Zendesk