Search

WooCommerce: Add an Inquiry Button for Particular Categories

    Sumit Pore
Listen to this article

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.

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.
Sumit Pore

Sumit Pore

3 Responses

  1. Hi there, I’m trying to show the button on a quick view popup? Is it possible. I ‘m thinking to buy the premium version but i have to be sure I can do this first. thanks.

    1. Hi Ale, some customization will have to be done to be able to display the enquiry button on the quick view pop up. However it is advisable to not have the enquiry button on a popup as that would mean displaying one popup (product enquiry form) over another popup (the quick view popup). It tends to reduce user experience.

  2. Is it possible to on click on add to cart button display enquiry form and as a user fill enquiry form then product will be added to cart ??? and redirect to add to cart page not to product single page ???

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