Favorites Selectors
- getFavoritesProducts
- getFavoritesProductsIds
- getFavorites
- isInitialLoading
- getFavoritesCount
- hasFavorites
- isFetching
- isCurrentProductOnFavoriteList
getFavoritesProducts
Section titled “getFavoritesProducts”Retrieves the current product stack from the favorites data in the store.
import { getFavoritesProducts } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getFavoritesProducts } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(Object|null): Returns the current products stack. If the product stack is not set yet, it returns null.
getFavoritesProductsIds
Section titled “getFavoritesProductsIds”Retrieves a collection of product IDs for the current products in the favorite list from the favorites data in the store.
import { getFavoritesProductsIds } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getFavoritesProductsIds } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(Array): A collection of product IDs. It returns an empty array as a default.
getFavorites
Section titled “getFavorites”Retrieves a collection of product data with all products that are in the favorite list from the favorites data in the store.
import { getFavorites } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getFavorites } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(Array): A collection of product data.
isInitialLoading
Section titled “isInitialLoading”Retrieves whether the favorite list is loading the very first time.
import { isInitialLoading } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { isInitialLoading } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(boolean): Whether the favorite list loads for the first time.
getFavoritesCount
Section titled “getFavoritesCount”Retrieves the number of products in the favorite list from the favorites data in the store.
import { getFavoritesCount } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getFavoritesCount } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(number): The number of products in the favorite list.
hasFavorites
Section titled “hasFavorites”Retrieves whether the favorite list has any products.
import { hasFavorites } from '@shopgate/pwa-common-commerce/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { hasFavorites } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”- *
state(Object) required: The application state.
Returns
Section titled “Returns”(boolean): Whether the favorite list has products.
isFetching
Section titled “isFetching”Retrieves whether the favorite list is currently fetching data.
import { isFetching } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { isFetching } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.
Returns
Section titled “Returns”(boolean): Whether the favorite list is fetching data.
isCurrentProductOnFavoriteList
Section titled “isCurrentProductOnFavoriteList”Retrieves whether the currently viewed product (inside a product list or on a product detail page) is already inside the favorite list.
import { isCurrentProductOnFavoriteList } from '@shopgate/engage/favorites';Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { isCurrentProductOnFavoriteList } from '@shopgate/pwa-common-commerce/favorites'
Parameters
Section titled “Parameters”state(Object) required: The application state.props(Object) required: An object containing properties.productId(string) required: The product ID to check for.
Returns
Section titled “Returns”(boolean): Whether the product is in the favorite list.

