Skip to content

Commit da6fc94

Browse files
committed
fix: "menu_order" pagination fixed
1 parent 36e79d3 commit da6fc94

File tree

8 files changed

+197
-88
lines changed

8 files changed

+197
-88
lines changed

bin/_lib.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ install_wordpress() {
3535
composer require --dev --no-interaction -W \
3636
johnpbloch/wordpress:* \
3737
wp-graphql/wp-graphql-jwt-authentication \
38-
axepress/wp-graphql-headless-login \
3938
wpackagist-plugin/woocommerce \
4039
wpackagist-plugin/woocommerce-gateway-stripe \
4140
wpackagist-plugin/wp-graphql \
@@ -51,7 +50,6 @@ remove_wordpress() {
5150

5251
# Remove WordPress dependencies
5352
composer remove --dev wp-graphql/wp-graphql-jwt-authentication \
54-
axepress/wp-graphql-headless-login \
5553
wpackagist-plugin/woocommerce-gateway-stripe \
5654
wpackagist-plugin/wp-graphql \
5755
wpackagist-theme/twentytwentyone \

composer.lock

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/data/connection/class-product-connection-resolver.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,23 @@ public function get_query_args() {
196196
$query_args['graphql_cursor_compare_by_price_key'] = 'wc_product_meta_lookup.max_price';
197197
$query_args['graphql_cursor_compare_by_price_value'] = $price;
198198
}
199-
}
200-
201-
if ( $offset_product && 'popularity' === $query_args['orderby'] ) {
199+
} elseif ( $offset_product && 'popularity' === $query_args['orderby'] ) {
202200
$query_args['graphql_cursor_compare_by_popularity_value'] = $offset_product->get_total_sales();
203201
$query_args['graphql_cursor_compare_by_popularity_key'] = 'wc_product_meta_lookup.total_sales';
204-
}
205-
206-
if ( $offset_product && 'rating' === $query_args['orderby'] ) {
202+
} elseif ( $offset_product && 'rating' === $query_args['orderby'] ) {
207203
$query_args['graphql_cursor_compare_by_rating_value'] = $offset_product->get_average_rating();
208204
$query_args['graphql_cursor_compare_by_rating_key'] = 'wc_product_meta_lookup.average_rating';
209-
}
210-
211-
if ( $offset_product && 'comment_count' === $query_args['orderby'] ) {
205+
} elseif ( $offset_product && 'comment_count' === $query_args['orderby'] ) {
212206
$query_args['graphql_cursor_compare_by_comment_count_value'] = $offset_product->get_rating_count();
213207
$query_args['graphql_cursor_compare_by_comment_count_key'] = 'wc_product_meta_lookup.rating_count';
214208
$query_args['graphql_cursor_compare_by_rating_value'] = $offset_product->get_average_rating();
215209
$query_args['graphql_cursor_compare_by_rating_key'] = 'wc_product_meta_lookup.average_rating';
210+
} elseif ( $offset_product && 'menu_order title' === $query_args['orderby'] ) {
211+
$query_args['orderby'] = [
212+
'menu_order' => $query_args['order'],
213+
'post_title' => isset( $this->args['last'] ) ? 'ASC' : 'DESC',
214+
];
215+
unset( $query_args['order'] );
216216
}
217217

218218
/**

0 commit comments

Comments
 (0)