0

I am having trouble adding custom column to Woocommerce Subscription.

My codes are as below:

add_filter( 'manage_shop_subscription_posts_columns', function ($columns) {
    $columns['my_field'] = __('My Field');

    return $columns;
}, 10);

What could be wrong with my code? I fail to understand why it is not working.

  • Is hard to say what is wrong with your code because WooCommerce has no subscription functionality , so you must use a 3th party plugin. I think you will get the best support from the plugin developer. Do you asked him or her? – user141080 Oct 2 '18 at 16:03
  • @user141080 It's a known addon sold by Woocommerce: woocommerce.com/products/woocommerce-subscriptions – Aniruddh Joshi Oct 2 '18 at 16:13
  • "WooCommerce Subscriptions" is a pay plugin so please ask the support for help – user141080 Oct 2 '18 at 16:15
  • @user141080 Hmm alright. I will post my answer here once I have a solution from them. – Aniruddh Joshi Oct 2 '18 at 17:55
0

Alright, so since WC Subscriptions is creating it's own array for columns. Any filter priority lesser than their function will simply make your code non-functional. So what I did is I changed priority from 10 to 1000 so that my codes fire after their code.

add_filter( 'manage_shop_subscription_posts_columns', function ($columns) {
    $columns['my_field'] = __('My Field');

    return $columns;
}, 1000);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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