getProductsById
Method fetching products by ids.
This method sends a GET request to the getProductsById endpoint of the Vue Storefront API Middleware. In turn, it receives data from the BigCommerce getProductsById GraphQL API.
Signature
declare function getProductsById(
props: index_d_exports$1.GetProductsByIdParameters,
options?: MethodOptions
): Promise<index_d_exports$1.ProductsResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | index_d_exports$1.GetProductsByIdParameters | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions |
Returns
Returns a response with the matching products data.
Examples
Fetching product data. Sending it this way, the response can be cached safely.
import { sdk } from '~/sdk.config.ts';
const products = await sdk.bigcommerce.getProductsById({ ids: ['77'] });