Skip to content

Instantly share code, notes, and snippets.

@wesleyalmd
Created April 28, 2020 00:16
Show Gist options
  • Save wesleyalmd/2cdde0c1653e50cff566a7a5e2a5bde4 to your computer and use it in GitHub Desktop.
Save wesleyalmd/2cdde0c1653e50cff566a7a5e2a5bde4 to your computer and use it in GitHub Desktop.
M2 GraphQL - Get Products by Category
query getProductsByCategoryId(
$currentPage: Int = 1
$pageSize: Int = 12
$categoryId: String!
) {
products(
currentPage: $currentPage
pageSize: $pageSize
search: ""
filter: {
category_id: {
eq: $categoryId
}
}
) {
items {
id
name
small_image {
url
}
url_key
price {
regularPrice {
amount {
value
currency
}
}
}
}
page_info {
total_pages
}
total_count
}
}
@wesleyalmd
Copy link
Author

query variables

{
  "categoryId": "133596"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment