E-Commerce WordPress Tips & Tricks

WooCommerce: Add an Inquiry Button for Particular Categories

Some product categories sell better with an inquiry button than a buy button. Here is how to add an inquiry button for particular categories in WooCommerce, so quote based items invite a conversation while the rest sell normally.

Sumit Pore Sumit Pore 4 min read
WooCommerce: Add an Inquiry Button for Particular Categories

Product Enquiry ProIn e-commerce potential customers make an inquiry when they have doubts to clear about a product they are interested in. And what does that mean to you- a store owner? As a store owner, this means an inquiry plugin is a must have for your store. And for WooCommerce store owners, the best inquiry plugin out there, is the Product Enquiry Pro by WisdmLabs.

The Product Enquiry Pro plugin is the most popular plugin built by WisdmLabs. This plugin adds an inquiry button on every WooCommerce single product page. But that’s the default functionality. The plugin provides several hooks and filters, using which you can selectively display the inquiry button, for the products in your WooCommerce store, according to your needs.

The Product Enquiry Pro Plugin

By default, the Product Enquiry Pro adds an inquiry button for every product in your WooCommerce store. An interested customer, who wants to forward to you a question about a product he/she is interested in, can click this inquiry button and fill out a ‘Product Enquiry’ form. This inquiry is sent as an e-mail to you- the store owner, and the product owner (if different).

Since version 1.3.1, the feature to selectively display the inquiry button was added to the Product Enquiry Pro plugin. The plugin provided settings using which, you could turn on or off the display of the inquiry button, on a per product basis. But additional hooks were also added, using which you could control the display of the inquiry button based on certain pre-conditions.

Take a Look at the Product Enquiry Pro- A Must Have Plugin for WooCommerce

View Details

 

Selectively Display an Inquiry Option

The ‘pep_before_deciding_position_of_enquiry_form’ filter, provides you a possibility to add a condition, before displaying the enquiry button. For Example: To disable the display of the button for specific product categories, you can add a condition, which checks for the product category before the button is displayed. You would need to write the below code in your current theme’s functions.php or in a custom plugin you create.

add_filter( 'pep_before_deciding_position_of_enquiry_form', 'disable_enquiry_for_few_categories', 15, 3 );
function disable_enquiry_for_few_categories( $enabled, $post_type, $product_id ) {
   if ( get_post_type( $product_id ) == 'product' ) {
//array of terms/categories for which you DO NOT want to show the enquiry button
       $array_of_terms = array( 'Clothing', 'Music', 'Posters' ); 
//lets find out all the terms associated with current product
       $list_of_term_names_for_this_product = wp_get_post_terms( $product_id, 'product_cat', array( 'fields' => 'names' ) );
       if ( $list_of_term_names_for_this_product !== FALSE ) {
           foreach ( $array_of_terms as $single_term ) {
               if ( in_array( $single_term, $list_of_term_names_for_this_product ) ) { 
//if the term we want is associated with the product, then lets disable enquiry form for it.
//returning false will disable enquiry form
                   return false; 
               }
           }
       }
   }
   return $enabled;
}

The important part of the above code is, the return value. If you want to disable the enquiry form, you should return false when the condition is satisfied.

Similarly, you can write your own conditions to disable the display of the inquiry option. Do note, that the inquiry button does not hide or replace the Add to Cart button for a WooCommerce product. To hide the Add to Cart button for your products, use the below code:

add_filter('woocommerce_is_purchasable', '__return_FALSE'); 

Potential customers making an inquiry, is a direct lead which you can’t afford to miss. The Product Enquiry Pro plugin by WisdmLabs is a comprehensive inquiry plugin for your WooCommerce store. With version 2.0, you can create a custom inquiry form as well. What do you think about this inquiry plugin? Do let me know your thoughts and questions, using the comment section below.

Read Further Resources

FAQ’s

  1. How can I add an inquiry button for specific product categories in WooCommerce?
    To add an inquiry button for particular categories in WooCommerce, you can use plugins like “Product Enquiry Form for WooCommerce” or custom code snippets to integrate the functionality into your store.
  2. Is it possible to customize the appearance and placement of the inquiry button?
    Yes, you can customize the appearance and placement of the inquiry button by modifying the CSS styles or using hooks provided by WooCommerce to position the button as per your requirements.
  3. Can customers submit inquiries directly from product category pages?
    With the right setup, customers can submit inquiries directly from product category pages by adding the inquiry button to those pages and linking it to the respective products.
Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

    Free 30-Min Strategy Call

    Your Name *

    Your Phone No *

    Work Email *

    Your Budget*

    Project Details *