1

I'm following this tutorial to merge My Account tabs: https://www.businessbloomer.com/woocommerce-merge-account-tabs/ I want to merge Orders and Subscriptions, thus hide Subscriptions tab and display its content in Orders tab.

So, unset($items['subscriptions']); works fine, the tab gets hidden.

But when I do add_action( 'woocommerce_account_orders_endpoint', 'woocommerce_account_subscriptions' ); it doesn't work, I get call_user_func_array() expects parameter 1 to be a valid callback, function 'woocommerce_account_subscriptions' not found or invalid function name.

Does anyone happen to know the correct callback function name?

bugnumber9
  • 451
  • 1
  • 4
  • 16

1 Answers1

2

Looking at their code... the callback function is a method of the class WCS_Query

So if you do this, it should work.

add_action( 'woocommerce_account_orders_endpoint', array(new WCS_Query(),'endpoint_content' ) );
Howard E
  • 5,454
  • 3
  • 15
  • 24
  • Tried that, got ```Fatal error: Uncaught Error: Class 'WCS_Query' not found in...``` – bugnumber9 Sep 20 '20 at 09:54
  • This works for me... Are you sure the plugin is enabled? What version number? This is what I see - https://snipboard.io/OSVN4C.jpg – Howard E Sep 20 '20 at 10:37
  • Ok, found the problem. I was adding the code to a custom plugin, not to functions.php of the theme. It works in functions.php but doesn't work in a custom plugin. Thanks! – bugnumber9 Sep 20 '20 at 11:15