Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

223
Vistas
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 Respuestas
Responde la pregunta

0

This is the hook you are looking for. 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; } add_filter('woocommerce_reports_get_order_report_data_args');
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda