Skip to content

Commit

Permalink
Fixed order by bug in WooCommerce api listing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jnesselr committed Jan 30, 2024
1 parent 957ad60 commit 7cbb8da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/External/WooCommerce/Api/WooCommerceApiMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ private function getWithPaging($url, array $options = [], ApiProgress $progress
$options[RequestOptions::QUERY] = [];
}

// If you don't order by id, the default is post_date which causes issues when two posts have the exact same timestamp.
// Forcing the order here isn't my favorite thing, but it can always be sorted later
$options[RequestOptions::QUERY]['orderby'] = 'id';

if (! Arr::has($options[RequestOptions::QUERY], 'per_page')) {
$options[RequestOptions::QUERY]['per_page'] = 100;
}
Expand Down

0 comments on commit 7cbb8da

Please sign in to comment.