How to add inquiry tab to your product in woocommerce using contact form 7

WooCommerce is the most popular WordPress eCommerce plugin. And it’s available for free. I guess one of the reason why you are here reading this is because you are using it.

Ever wonder how to use Contact Form 7Β in your WooCommerce product as a method for inquiry purpose? Well, this is the topic all about. I will teach you how.

If you’re in a hurry and don’t want to read along, you can download this file, upload this to your plugins, then activate. But before that, make sure to replace the shortcode with yours. It’s in the bottom part that says echo do_shortcode(‘[contact-form-7 id=”1430″ title=”Contact form 1″]’);. Replace [contact-form-7 id=”1430″ title=”Contact form 1″] with your shortcode from contact form 7 settings. Look at line 49.

If you have done that, now look at your product item page!

Read the commented code to learn more…

Also, you can copy paste this to your functions.php file in your current theme.

Let me know in comments below if you have problems.

Also, this code is not limited to just Contact Form 7 and 1 additional tab πŸ™‚ Use your imagination…

UPDATE
And after writing this post… a plugin was born… you can download and try it WooCommerce WooRei Easy Tab.

UPDATE 01.26.2016
A new better way of adding Contact Form 7 as Product tab is here.

You may also like...

17 Responses

  1. Sieger says:

    Hello,

    This looks like the plug in for me! But, i used the free Customizr theme, in which i can’t change or add anything to the functions.php. Is there any way for me to add the contact form 7 to my product pages in one simple action?

    • Reigel Gallarde says:

      you don’t need to edit functions.php…

      just click the link below the above codes that says ‘woocommerce_product_tabs_contact_form7.php’ and download it… upload it to your plugins in admin dashboard…

      also, before uploading it, change this `[contact-form-7 id="1430" title="Contact form 1"]` to your contact form 7 shortcode…

      • Sieger says:

        Thanks for the fast reply.. where can i change the shortcode before uploading?

      • Reigel Gallarde says:

        after you have downloaded the file, open it in notepad or any text editor. locate at the bottom where it says `echo do_shortcode`… you should changed the shortcode there.

  2. Meybo says:

    Thank You for this very useful code!

    This works very well, but I have one issue. After pressing “Submit” button page reloads and WooCommerce opens firts tab. This is not good, because if form has errors customer won’t see these and if not, customer can’t see success message. Do You have some simple solution for that?

    • Reigel Gallarde says:

      can I look at the page you are talking about? just give me a link. πŸ˜‰

      • Meybo says:

        Excuse me, this issue was totally my mistake and I figured out problem source. I have configured to load wpcf7 ajax script only when wpcf7 shortcode on page, but under the WooCommerce tab shortcode is hided and script won’t loading. Now wpcf7 ajax loading also in WooCommerce single product pages and problem solved πŸ™‚

  3. rod says:

    It works for me, but, on the email that i recieve, it doesn’t show from what product it was sent, can it be fixed?

  4. Raj says:

    How Could you fixed that product id issues. I cant get the product details with my contact Form. Please help me.

    • Reigel Gallarde says:

      Can you explain what you’re trying to do?

      • Raj says:

        I’m trying to Add Product enquiry form for my woocommerce products. For this code i can only get the enquiry form details. but i can’t get which product got enquiry. how can i add name of the product, price, and prodcut id with my form. sorry for my bad english and thanks for fast replay

      • Reigel Gallarde says:

        hmm.. There’s nothing you can do about that in my code. You have to access Contact Form 7. That is you have to make a function that relates to Contact Form 7. I can’t give you all the details but you can start here http://contactform7.com/special-mail-tags/. That link contains all the special tag of CF7. It has a special tag you can use in your contact form in the dashboard. And also, if you want to get more advanced, you can use a hook before you send the mail. More about that here.

  5. Raj says:

    Thanks, Special-mail-tags will help me a lot. i can get the product details. thanks a lot. but i don’t have a idea in use a hook functionality. I think its used to store contact form data’s in database i don’t know am i right or not. can u explain about functionality if you willing.. anyway thanks a lot for fast replay mr.Reigel. you can exaplain via mail also.

    • Reigel Gallarde says:

      hmm… if you are not a programmer, you will have a hard time with that. I can’t help you right now because I’m busy with work. πŸ™‚