Skip to content

Instantly share code, notes, and snippets.

@reigelgallarde
Last active February 27, 2017 20:35
Show Gist options
  • Save reigelgallarde/f6781c2bda091f901c46 to your computer and use it in GitHub Desktop.
Save reigelgallarde/f6781c2bda091f901c46 to your computer and use it in GitHub Desktop.
WooCommerce Additional Tab Product Inquiry.
<?php
/**
* Plugin Name: WooCommerce plus Contact Form 7
* Plugin URI: http://reigelgallarde.me/plugins/how-to-add-inquiry-tab-to-your-product-in-woocommerce-using-contact-form-7
* Description: Additional Tab Product Inquiry.
* Author: Reigel Gallarde
* Author URI: http://reigelgallarde.me
* Version: 0.1
* Tested up to: 4.1
*
*
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*
* @package
* @author Reigel Gallarde
* @category Plugin
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
/**
* Exit if accessed directly
**/
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Check if WooCommerce is active
**/
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
return;
}
// let's add a filter to woocommerce_product_tabs to add our additional tab..
add_filter('woocommerce_product_tabs','woocommerce_product_tabs_contact_form7',10,1);
function woocommerce_product_tabs_contact_form7($tabs){
$tabs['contact_form7'] = array(
'title' => __( 'Enquiry', 'woocommerce' ),
'priority' => 20,
'callback' => 'woocommerce_product_contact_form7_tab'
);
return $tabs;
}
// our tab's callback...
function woocommerce_product_contact_form7_tab(){
// do the thing zhu li! Let's echo our shortcode for contact form 7
echo do_shortcode('[contact-form-7 id="1430" title="Contact form 1"]');
}
@wansell
Copy link

wansell commented Nov 13, 2015

Hello,

Is there a way to have the product title/name as part of the email that gets sent.

Thanks

@lukecav
Copy link

lukecav commented Feb 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment