Error: Call to a member function addWhere() on array in hook_views_query_alter()
Try to add your condition to conditions array in the where  $query-&gt;where like the following:

/**
 * Implements hook_views_query_alter().
 */
function myModule_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  if ($view-&gt;id() === 'search_filter' &amp;&amp; $view-&gt;current_display === 'block_1') {
    $field = 'node__field_country.field_country_target_id';
    $value = 'someValue';
    $operator = '=';
    if (isset($query-&gt;where[1]['conditions'])) {
      $query-&gt;where[1]['conditions'][] = [
        "field"    =&gt; $field,
        "value"    =&gt; $value,
        "operator" =&gt; $operator,
      ];
    }
  }
}


Read this Article it's very useful.