Add a filter to change teh ordering of the exported appointments

Issue #721 resolved
Valentina R created an issue

By default, they are ordered by appointment ID and it would be more useful if it would be the DateTime instead. Having a filter so that anyone could decide what they want would be the best.

Requested here.

Comments (3)

  1. Valentina R reporter

    Not working for ordering. At least not with these snippets:

    add_filter('woocommerce_appointment_export_data_args', function($args){
      $args['orderby'] = array('Start timestamp' => 'DESC');
      return $args;
    },1,99);
    

    add_filter('woocommerce_appointment_export_data_args', function($args){
      $args['orderby'] = array('start' => 'DESC');
      return $args;
    },1,99);
    

  2. Željan Topić

    After 4.9.11, the following code snippet can be used for this:

    add_filter( 'woocommerce_appointment_export_data_args', 'modify_appointment_export_data_args', 10, 2 );
    function modify_appointment_export_data_args( $args, $exporter ) {
        $args['order_by'] = 'start_date';
        $args['order']    = 'DESC';
    
        return $args;
    }
    

  3. Log in to comment