Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 3061745

Browse files
authored
Merge pull request #3127 from wordpress-mobile/issue/13373-sort-variations-menu-order
[Woo POS][Non-Simple Products] Sort variations by menu_order
2 parents 657a72d + c7b933c commit 3061745

File tree

1 file changed

+2
-9
lines changed
  • plugins/woocommerce/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/product

1 file changed

+2
-9
lines changed

plugins/woocommerce/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/product/ProductRestClient.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,6 @@ class ProductRestClient @Inject constructor(
866866
*
867867
* @param [productId] Unique server id of the product
868868
*
869-
* Variations by default are sorted by `menu_order` with sorting order = desc.
870-
* i.e. `orderby` = `menu_order` and `order` = `desc`
871-
*
872-
* We do not pass `orderby` field in the request here because the API does not support `orderby`
873-
* with `menu_order` as value. But we still need to pass `order` field to the API request in order to
874-
* preserve the sorting order when fetching multiple pages of variations.
875-
*
876869
*/
877870
suspend fun fetchProductVariations(
878871
site: SiteModel,
@@ -885,7 +878,7 @@ class ProductRestClient @Inject constructor(
885878
"per_page" to pageSize.toString(),
886879
"offset" to offset.toString(),
887880
"order" to "asc",
888-
"orderby" to "date"
881+
"orderby" to "menu_order"
889882
)
890883

891884
val response = wooNetwork.executeGetGsonRequest(
@@ -944,7 +937,7 @@ class ProductRestClient @Inject constructor(
944937
): WooPayload<List<WCProductVariationModel>> {
945938
val params = mutableMapOf(
946939
"per_page" to pageSize.toString(),
947-
"orderby" to "date",
940+
"orderby" to "menu_order",
948941
"order" to "asc",
949942
"offset" to offset.toString()
950943
).putIfNotEmpty("search" to searchQuery)

0 commit comments

Comments
 (0)