WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would i use the wooCommerce hooks in my wp plugin? Here is what i am trying to do:

    add_filter('woocommerce_edit_product_columns', 'pA_manage_posts_columns');
    function pA_manage_posts_columns($columns, $post_type = 'product') {
    global $woocommerce;
if ( in_array( $post_type, array( 'product') ) ) {
        $columns['offering_price'] = __( 'offering price', 'your_text_domain' ); // this offering price title 
        $columns['offering_qty'] = __( 'Qty', 'your_text_domain' ); // add the quantity title
return $columns;


I have included the woocommerce class:

$base_dir = realpath(dirname(__FILE__)  . $ds . '..') . $ds;
$file = "{$base_dir}woocommerce{$ds}woocommerce.php"; 
share|improve this question
add_filter('woocommerce_edit_product_columns', 'pA_manage_posts_columns',99); try this – pr1nc3 Sep 30 '13 at 14:15
didn't work, i kinda think that woocommerce is not included in my plugin file, since i can't access the global $woocommerce either. – Mahaein Sep 30 '13 at 14:20
This isnt very difficult task to see if plugin is active .. is it ? please check it. – pr1nc3 Sep 30 '13 at 14:21
Thank you, I activated the plugin, include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); activate_plugin(ABSPATH . 'wp-content/plugins/woocommerce/woocommerce.php'); still can't get the woocommerce hoook to add or remove the columns – Mahaein Oct 1 '13 at 10:08
up vote 0 down vote accepted

I believe, the hook is called differently

add_filter( 'manage_edit-product_columns', ... )

The 'woocommerce_edit_product_columns' is not a hook name, but a function name in WC 2.0

As for the access to global $woocommerce - as long as the WooCommerce plugin is loaded, it's available. If, however, your plugin is loaded before WooCommerce (alphabetically), then you can should do something within a function hooked to 'plugins_loaded'.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.