Adding product sort
Your marketplace has shop pages with shop details and product categories. You want to give buyers a way of organizing the products, in dedicated pages.
In this tutorial, you'll add sort functionality to shops. You'll set up product sort by title, price, best-selling, and creation date, but you can follow a similar structure to provide sort options by other product attributes. Refer to the Storefront API to see all supported sorting options.
What you'll learn
Anchor link to section titled "What you'll learn"After finishing this tutorial, you'll know how to add sort functionality to shop pages.
Requirements
Anchor link to section titled "Requirements"- You've finished the tutorial for adding product categories.
Sort products from the Storefront API
Anchor link to section titled "Sort products from the Storefront API"Update the products query to accept sortKey
and reverse
arguments.
You can use this data in sort selectors for pages. The following is an example:
Learn how to add product filters to the shop pages in a marketplace.
Share feedback on Marketplace Kit.