Skip to content

Product in mutilple category #146

Answered by sags95
balanh-development asked this question in Help
Discussion options

You must be logged in to vote

Hi @balanh-development ,

You can use the /categories:products endpoint in order to assign the product to categories. You would pass in the category id as the parent_id.

POST /categories:products { product_id, parent_id }

To retrieve products from multiple categories, you can pass in a list of categories:

GET '/products', {
  categories: [...ids]
}

As to your question regarding filtering on the frontend, this would be done by passing in attributes within the $filters object like you describe (size, color, etc) along with the category.

await swell.products.list({
  page,
  limit,
  sort,
  categories, // optional category slug or ID
  $filters: {
    price: [10, 20],
    category: ['featu…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dyk9456
Comment options

@logeshswell
Comment options

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