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

Commit c7b933c

Browse files
committed
Sort variations by menu_order
1 parent 7c0c11f commit c7b933c

File tree

1 file changed

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

1 file changed

+1
-8
lines changed

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

Lines changed: 1 addition & 8 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(

0 commit comments

Comments
 (0)