Skip to content

Product Actions

Fetches a product from the server.

import { fetchProduct } from '@shopgate/engage/product';
const productId = 'abc123';
const forceFetch = false;
dispatch(fetchProduct(productId, forceFetch));
  • productId (string) required: The ID of the product to fetch.
  • forceFetch (boolean): Default is false. Indicates if the product should be fetched, even if there is a still valid entry inside of Redux.

Fetches a product description from the server.

import { fetchProductDescription } from '@shopgate/engage/product';
const productId = 'abc123';
dispatch(fetchProductDescription(productId));
  • productId (string) required: The ID of the related product.

Fetches product images from the server.

import { fetchProductImages } from '@shopgate/engage/product';
const productId = 'abc123';
const formats = [{
width: 1024,
height: 1024,
}];
dispatch(fetchProductImages(productId, formats));
  • productId (string) required: The ID of the related product.
  • formats (Array<Object>) required: The desired formats for the images.
    • height (number) required: The height of the format.
    • width (number) required: The width of the format.

Fetches product options from the server.

import { fetchProductOptions } from '@shopgate/engage/product';
const productId = 'abc123';
dispatch(fetchProductOptions(productId));
  • productId (string) required: The ID of the related product.

Fetches product properties from the server.

import { fetchProductProperties } from '@shopgate/engage/product';
const productId = 'abc123';
dispatch(fetchProductProperties(productId));
  • productId (string) required: The ID of the related product.

Fetches product relations from the server.

import {
fetchProductRelations,
PRODUCT_RELATIONS_TYPE_UPSELLING
} from '@shopgate/engage/product';
const productId = 'abc123';
const type = PRODUCT_RELATIONS_TYPE_UPSELLING;
dispatch(fetchProductRelations(productId, type));
  • productId (string) required: The ID of the related product.
  • type (string) required: The desired type of the related products.
    • Possible Values: crossSelling, upselling, bonus, boughtWith, custom. All of these values are prepared as constants. They can be imported like in the snippet below.
  • limit (number): The number of related products to request. Default is 20 items.
import {
PRODUCT_RELATIONS_TYPE_CROSS_SELLING,
PRODUCT_RELATIONS_TYPE_UPSELLING,
PRODUCT_RELATIONS_TYPE_BONUS,
PRODUCT_RELATIONS_TYPE_BOUGHT_WITH,
PRODUCT_RELATIONS_TYPE_CUSTOM
} from '@shopgate/engage/product';

`


Fetches shipping information for a product from the server.

import { fetchProductShipping } from '@shopgate/engage/product';
const productId = 'abc123';
dispatch(fetchProductShipping(productId));
  • productId (string) required: The ID of the related product.

Fetches product variants from the server.

import { fetchProductVariants } from '@shopgate/engage/product';
const productId = 'abc123';
dispatch(fetchProductVariants(productId));
  • productId (string) required: The ID of the related product.