Category Actions
fetchCategory
Section titled “fetchCategory”Retrieves the data for a given category ID (including child categories).
import { fetchCategory } from '@shopgate/engage/category';
const categoryId = '25';
dispatch(fetchCategory(categoryId));Parameters
Section titled “Parameters”categoryId(string) required: The ID for the category to fetch.
fetchCategoryChildren
Section titled “fetchCategoryChildren”Retrieves the child categories for a given category ID.
import { fetchCategoryChildren } from '@shopgate/engage/category';
const categoryId = '25';
dispatch(fetchCategoryChildren(categoryId));Parameters
Section titled “Parameters”categoryId(string) required: The ID for the category to fetch.
fetchCategoryProducts
Section titled “fetchCategoryProducts”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}));Parameters
Section titled “Parameters”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:
- Possible Values:
import { SORT_RELEVANCE, SORT_PRICE_ASC, SORT_PRICE_DESC } from '@shopgate/engage/core';fetchRootCategories
Section titled “fetchRootCategories”Retrieves the root categories from the store.
import { fetchRootCategories } from '@shopgate/engage/category';
dispatch(fetchRootCategories());
