Skip to content

Category Actions

Retrieves the data for a given category ID (including child categories).

import { fetchCategory } from '@shopgate/engage/category';
const categoryId = '25';
dispatch(fetchCategory(categoryId));
  • categoryId(string) required: The ID for the category to fetch.

Retrieves the child categories for a given category ID.

import { fetchCategoryChildren } from '@shopgate/engage/category';
const categoryId = '25';
dispatch(fetchCategoryChildren(categoryId));
  • categoryId(string) required: The ID for the category to fetch.

Retrieves category products by a category ID.

import { fetchCategoryProducts } from '@shopgate/engage/category';
const categoryId = '25';
const offset = 10;
const limit = 3;
const sort = 'priceAsc';
const filters = {
display_amount: {
minimum: 299,
maximum: 4900
},
manufacturer: {
values: ['Shopgate', 'ACME']
}
}
dispatch(fetchCategoryProducts({categoryId, offset, limit, sort, filters}));
  • categoryId(string) required: The ID for the category to fetch.
  • offset(number): The offset for the products to request. Default is 0.
  • limit(number): The number of products to request. Default is 30 items.
  • filters (Object): Additional filters for the request.
  • sort(string): The sort scheme. Default is by relevance.
    • Possible Values: relevance, priceAsc, priceDesc. All of these values are prepared as constants. They can be imported like this:
import { SORT_RELEVANCE, SORT_PRICE_ASC, SORT_PRICE_DESC } from '@shopgate/engage/core';

Retrieves the root categories from the store.

import { fetchRootCategories } from '@shopgate/engage/category';
dispatch(fetchRootCategories());