There are cases in which you want to unregister all the hooks to a action in wordpress/woocommerce, example to fully disable an action.

Normally in order to remove a hook properly you need its name, function name and its priority without knowing this you will not be able to register them.

  1. First lest get all the hooked functions and its priority for particular named action/filter in a recursive manner.
  2. Then using a for loop we call remove_action() to unregister the hooks.

function _devnodes_unregister_all_action_hooks($action_name) 
{
  global $wp_filter;

  $hooks_list = array();

  if ( isset( $wp_filter[$action_name] ) && 0 < iterator_count( $wp_filter[$action_name] ) ) {
    foreach ( $wp_filter[$action_name] as $k => $v ) {
      if ( is_array( $v ) ) {
        foreach ( $v as $i => $j ) {
          $hooks_list[] = array(
            'priority' => $k,
            'function' => $j['function'],
          );
        }
      }
    }

    foreach ( $hooks_list as $k => $hook ) {
      remove_action($action_name, $hook['function'], $hook['priority']);
    }
  }
}

Any where in the child theme’s function.php you may call like this. It’ll be fired only once ( during theme activation ).

add_action('after_switch_theme', 'devnodes_switch_theme');

function devnodes_switch_theme () {
  _devnodes_unregister_all_action_hooks('storefront_header') 
  _devnodes_unregister_all_action_hooks('storefront_footer') 
}