Skip to content

Cart Selectors

Retrieves all cart items from the cart data in the store.

import { getCartItems } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartItems } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Array): The cart items as an array. If no items are found, it returns an empty array.

Cart items will match the cartItems from the getCart pipeline response.


Retrieves a cart item from the cart data in the store by the item’s ID.

import { getCartItemById } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartItemById } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.
  • props (Object) required: An object containing props.
    • cartItemId (string) required

(Object|null): The cart item. If no item is found for the provided ID, the selector returns null.

The cart item will match the cartItems from the getCart pipeline response.


Retrieves all cart items from the cart data in the store that are of type product.

import { getCartProducts } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartProducts } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Array): An array of the products in the cart data. If no products are found, it returns an empty array .

Cart products will match the cartItems of type “product” from the getCart pipeline response.


Retrieves all cart items from the cart data in the store that are of the type coupon.

import { getCartCoupons } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartCoupons } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Array): An array of the coupons in the cart. If no coupons are found, it returns an empty array.

Cart coupons will match the cartItems of type “coupon” from the getCart pipeline response.


Retrieves the number of products from the cart data in the store. This number is synchronized with the backend and reflects the actual number of products in the cart.

import { getCartProductCount } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartProductCount } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(number): The current amount of products in the cart. If there are no products, it returns 0. Important: getCartProductCount does not include the coupons.


Retrieves the number of products from the cart data in the store that are only in the frontend and have not yet synchronized with the backend.

import { getProductPendingCount } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getProductPendingCount } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(number): The current pending product count. It returns 0 by default.


Retrieves the full number of products from the cart data in the store. It combines the product count and the pending product count. This number is equal to the product count when newly added products are synchronized with the backend.

import { getCartProductDisplayCount } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartProductDisplayCount } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(number): The current number of products in the cart data of the store.


Retrieves the current isOrderable status from the cart data in the store.

import { getOrderableStatus } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getOrderableStatus } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(boolean): Whether the cart is orderable.


The cart data that is received from the getCart pipeline contains information about the currency used for the current cart. This selector retrieves the currency code from that cart data in the store.

import { getOrderableStatus } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getOrderableStatus } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(string): The currency code. Examples include USD or EUR.


Retrieves the subtotal before shipping costs from the cart data in the store.

import { getSubTotal } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getSubTotal } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(number): The subtotal as a float number.


Retrieves the total shipping costs from the cart data in the store.

import { getShippingCosts } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getShippingCosts } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(number|null): The shipping costs as a float number. It returns 0 on free shipping, and null if no shipping costs are found.


Retrieves all messages that are present in the cart data in the store.

import { getCartMessages } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getCartMessages } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Array): An array of messages. If no messages are set, it returns an empty array.


Retrieves additional information about the cart from the cart data in the store.

import { getFlags } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getFlags } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Object): The cart flags.

  • taxIncluded (boolean): Whether the cart shows gross or net prices.
  • orderable (boolean): Whether the cart is orderable.
  • coupons (boolean): Whether the cart can have coupons.

Builds the data for the options property in the addProducts pipeline request payload.

import { getAddToCartOptions } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getAddToCartOptions } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.
  • props (Object) required: An object containing props.
    • options (Object) required: The product options.

(Object|null): The options for the pipeline request.


Builds the data for the metadata property in the addProducts pipeline request payload.

import { getAddToCartMetadata } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getAddToCartMetadata } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(Object|null): The metadata object for the pipeline request.


Checks if the cart supports redemption of coupons.

import { hasCouponSupport } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { hasCouponSupport } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(boolean): Whether the coupons feature is enabled.


Checks if the cart is currently fetching fresh data.

import { getIsFetching } from '@shopgate/engage/cart';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getIsFetching } from '@shopgate/pwa-common-commerce/cart'

  • state (Object) required: The application state.

(boolean): Whether the cart is fetching.