php - Determine if an WooCommerce order contains order notes while using "woe_order_export_started" hook

one text

Solution:

The following answer returns false if there are no order notes, while using the woo_order_export_started filter hook

function filter_woe_order_export_started( $order_id ) {
    // Get order notes
    $notes = wc_get_order_notes( array(
        'order_id' => $order_id,
        'order_by' => 'date_created',
        'order' => 'ASC',
    ));
    
    // Notes is empty
    if ( empty( $notes ) ) {
        return false;
    }
    
    return $order_id;
}
add_filter( 'woe_order_export_started', 'filter_woe_order_export_started', 10, 1 );

Source