Created
February 26, 2026 06:03
-
-
Save aimahdi/6204b571bab33f157e0ed3b032d3a4a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('fluent_cart/shop_query', function($query, $params) { | |
| // Change default sort to ID-based (instead of alphabetical) | |
| // Only apply when sort_by is not explicitly set | |
| if (!isset($params['filters']['sort_by'])) { | |
| $query->orderBy('ID', 'DESC'); | |
| } | |
| return $query; | |
| }, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment