Search

Looking for a Customizable Inquiry Form for WooCommerce?

    Jignashu Solanki
Listen to this article

PEP LogoHow many of you have an inquiry plugin in your WooCommerce store? And are you happy with the inquiry plugin you use? If you’re using a free plugin which works fine, I’m sure you don’t have much to complain about. And what about those of you who’ve purchased an inquiry plugin, is it exactly what you need?

Owing to the fact that you’re reading this article, I’m guessing not.

How can a store bought plugin perfectly suit your needs? Sure it provides a quick and easy way for customers to contact you, but wouldn’t it be better if you could personalize the inquiry form? Maybe the plugin allowed you to do this… customize your inquiry form. Now we’re talking. This inquiry plugin for WooCommerce, which allows you to create a custom inquiry form, can and will perfectly suit your needs.

[space]

How can a Customizable Inquiry Form for WooCommerce Help?

Having built a popular inquiry plugin Product Enquiry Pro, we have had several customer requests sent our way. And from the feedback we’d received, 70% of customers wanted a customizable inquiry form. Most of the times (even if a reason hasn’t been specified), it was quite apparent why they would want a custom inquiry form. For example, a PEP customer asked us to add a variation drop-down field, because all his products were variable products. Another PEP owner who had a travel website, needed a date field to be added.

A customized or rather personalized inquiry form helps because:

  1. You can service leads efficiently by filtering them based on additional fields you’ve added.
  2. A customer can quickly fill up the form, add a shorter message because the fields better target his requirement.
  3. The inquiry form fields are relevant to your website

Because of the several requests which came in, we decided to add the customizable inquiry form as a feature of the Product Enquiry Pro plugin.

[space]

Product Enquiry Pro: The WooCommerce Inquiry Plugin with a Customizable Inquiry Form

With version 2.0 of Product Enquiry Pro for WooCommerce, plugin owners can now customize the inquiry form. An inquiry form provided by PEP, by default, provides a name field, e-mail field, subject field, telephone field (optional) and message field. Each field in the inquiry form has certain properties. For example, certain fields are required to be filled, and certain are optional. A field has basic validation as well. For example, an e-mail id has to have a particular format.

Thus customization of the inquiry form could include:

  1. Adding Fields
  2. Removing existing fields
  3. Changing field properties
  4. Changing validation

The Product Enquiry Pro plugin provides hooks using which you can add, remove or change certain fields. Okay so a little bit of coding is involved, but you have a detailed guide to inquiry form customization. To give you a preview of the guide, here’s what it has to offer.

[space]

How to Customize the WooCommerce Inquiry Form?

To edit the inquiry form, either add/remove or edit field properties, you have to make use of a filter hook. The filter hook you have to use, will depend on the field you want to edit. For example, say you want to make the subject field mandatory. In this case you will use the pep_fields_txtsubject hook. This works even when you have to remove the field, or add a field above or below an existing field.

For example, a client asked us to add a street address field below the telephone number field. If he had to do this himself, this is what he would need to do:

Step 1: Now, the hook needed here is pep_fields_txtphone (txtphone corresponds to the telephone number field).

Step 2: Since he would have to add some code, he would need to either add it in his theme’s functions.php or in a custom plugin. Whichever method he’d be comfortable with. (My recommendation was to add it in the theme, since he had his own child theme).

Step 3: Okay. Next, he would have to actually write the code. As per the guide, he would have to follow the How to Add Fields to the Enquiry Form? section.

For you first time readers, I’ll help you out. You just have to use this idea, and make changes accordingly. Begin with adding a function to the hook

/* since we have to add this field next to the telephone number field, hook the function on pep_fields_txtphone */
add_filter( 'pep_fields_txtphone', 'pep_add_street', 10, 1 );

// the function accepts an array containing the existing fields
function pep_add_street($enq_fields){
  // we have to create a new field for ‘street’, and add it to the array
  $street_name = array(

  // add a unique id
  'id' => 'street',

  // add a class for the field, you can add a custom class as well
  'class' => 'wdm-modal_text',

  // set the field type
  'type' => 'text',

  // add a placeholder
  'placeholder' => 'Street Name',

  // set the ‘required’ property of the field
  'required' => 'yes',

  // add a validation message if field is required
  'required_message' => 'Please enter your Street Address',

  // add a validation string
  'validation' => '^[0-9a-zA-Z. \']+$',
  'validation_message' => 'Please enter a valid Street Address',

  // set ‘yes’ if you want this value to be sent via e-mail, else ‘no’
  'include_in_admin_mail' => 'yes',

  // set ‘yes’ if you want this value to be sent in the customer’s e-mail, else ‘no’
  'include_in_customer_mail' => 'no',

  // enter a label
  'label' => 'Street Name',

  // add a default value
  'value' => ''
  );

  // placing the field after $enq_fields, will place the street name, below the telephone field
  $enq_fields = array( $enq_fields, $street_name );
  return $enq_fields;
}

The client of course didn’t make the changes himself, but rather sent us a customization request. And you can do the same, to save the hair tearing out.

[space]

How to Filter Inquiries based on Custom Fields?

Oh and here’s the best part! Every field you add, will be added to the inquiry records in the dashboard as well, as provided by Product Enquiry Pro. You can filter and export details based on values entered for this field.

[space]

And there you have it! Perfect isn’t it?! Product Enquiry Pro for WooCommerce can help you personalize your inquiry form, allowing customers to easily make inquiries, and helping you analyse them efficiently as well.

Got questions? Send them to me using the comment section below!

Jignashu Solanki

Jignashu Solanki

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads