How to convert contact form7 into a woocommerce product enquiry form
WooCommerce is a free and most popular eCommerce plugin for wordpress, it is really a useful plugin for eCommerce businesses. This plugin was created in 2011 and is now used by thousands of eCommerce websites worldwide. It is an easy toolkit that lets you sell anything you want online.
If you are running your shop with woocommerce this article is for you. the bridge between the potential customer and the product owner is important in eCommerce, you can easily convert a visitor (enquiry and presales ) into a sale. This bridge (form) will offer the customer to enquire about the products before they purchase
Imagine your WooCommerce shop contains thousand’s of products and if you don’t even specify any of your products price or some of the products running out of stock, what actually the customer will do? just leave a message from your site contact us page, but it is a tedious task for the shop owners to find out the query belongs to which product.
By adding a product enquiry form tab in to each of your product page allows the customers to directly contact you and enquire specifically about that product. The store manager will receive the email and can reply to the customer directly. you can easily extend all contact form7 features in your enquiry form like reCAPTCHA. add the following php codes to your Theme “function.php” file
Step 1: Add a filter to create product tab
In order to add our contact_form7 (additional) tab to “woocommerce_product_tabs” Lets add a filter.
add_filter('woocommerce_product_tabs','wc_product_tabs_contact_form7',10,1); function wc_product_tabs_contact_form7($tabs){ $tabs['contact_form7'] = array( 'title' => __( 'Enquiry', 'woocommerce' ), 'priority' => 20, 'callback' => 'wc_product_contact_form7_tab' ); return $tabs; }
as a result it will create a new tab with name “Enquiry” if you prefer a different name then you can update it on title.
Step 2: Define callback function
Then define the callback function(wc_product_contact_form7_tab) that will echo the contact form.
function wc_product_contact_form7_tab(){ // just paste the contact form 7 shortcode here echo do_shortcode('[contact-form-7 id="450" title="Contact form 1"]'); }
Most of all already using Contact form7 as a Enquiry form but this article will help you to use the same contact form7 as a product enquiry form.
If you have faced any problem Let me know in comments section or just send a message from our site contact form section Here