There is “Product Listing Sort By“ setting in the Magento’s catalog configuration. These options (e.g. Position, Name, Price asc/desc) are used to change default sorting in product listing. And these options are necessary to render the toolbar on the client side. Of course those options could be written as an JS variable during HTML server side rendering but it would be more convenient to get them together with the pagination information.
See how to expose a new query via GraphQL in Magento
Acceptance criteria:
sort_fields field should be added to Products GraphQL type (see Magento/CatalogGraphQl/etc/schema.graphqls )
- Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.