Skip to content

Commit

Permalink
Merge pull request #2577 from 10up/fix/keep-wc-orderby
Browse files Browse the repository at this point in the history
Remove unnecessary order adjustment for WC queries
  • Loading branch information
felipeelia authored Jan 28, 2022
2 parents 81e30e4 + 1b9b8ea commit e051161
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ ElasticPress has an in depth documentation site. [Visit the docs ☞](http://10u

ElasticPress FAQs and tutorials can be found on our support site. [Visit the support site ☞](https://elasticpress.zendesk.com/hc/en-us)

## Requirements
## Requirements and Compatibility

### Requirements

ElasticPress requires these software with the following versions:

* [Elasticsearch](https://www.elastic.co) 5.0+ **ElasticSearch max version supported: 7.9**
* [WordPress](http://wordpress.org) 3.7.1+
* [PHP](https://php.net/) 5.6+

### Compatibility

The WooCommerce feature is compatible with the last two major versions of the [WooCommerce plugin](https://wordpress.org/plugins/woocommerce/).

## React Components

Interested in integrating ElasticPress in your headless WordPress website? Check out [ElasticPress React](https://github.com/10up/elasticpress-react).
Expand Down
10 changes: 0 additions & 10 deletions includes/classes/Feature/WooCommerce/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,6 @@ public function translate_args( $query ) {
$query->query['ep_integrate'] = true;

if ( ! empty( $s ) ) {
$query->set( 'orderby', false ); // Just order by relevance.

/**
* Default order when doing search in Woocommerce is 'ASC'
* These lines will change it to 'DESC' as we want to most relevant result
*/
if ( empty( $_GET['orderby'] ) && $query->is_main_query() ) { // phpcs:ignore WordPress.Security.NonceVerification
$query->set( 'order', 'DESC' );
}

// Search query
if ( 'shop_order' === $post_type ) {
$default_search_fields = array( 'post_title', 'post_content', 'post_excerpt' );
Expand Down

0 comments on commit e051161

Please sign in to comment.