Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
Restrict WooCommerce Analytics to certain orders

I would like only certain orders to be taken into account in the whole Analytics Section. I found the "woocommerce_reports_get_order_report_data_args" filter, but I am having trouble making it work.

My orders have some meta data, which I set up using ACF. I wrote this snippet :

add_filter('woocommerce_reports_get_order_report_data_args', 'only_show_report_for_some_orders');
function only_show_report_for_some_orders( $args ) {
  $args['where_meta'] = array(
    'relation' => 'AND',
    array(
      'meta_key' => 'type_commande',
      'meta_value' => array('commande','sous-depot-vente'),
      'operator' => 'IN'
    ),
  );
  return $args;
}

I get one error in the console (Internal Server Error) and also, most of the analytics are displayed (but for all my orders), so I guess I am not using the right filter, and my use of the where_meta parameter might be wrong...

Thanks in advance!!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

add_filter('woocommerce_reports_get_order_report_data_args', 'woocommerce_reports_get_order_report_data_args');

function woocommerce_reports_get_order_report_data_args($args) {
    $args['where_meta'] = array(
        'meta_key' => 'type_commande',
        'operator' => 'in',
        'meta_value' => array('commande', 'sous-depot-vente')
    );
    return $args;
}

This is the hook you are looking for.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda