getProductById
Method fetching a product by its ids.
This method sends a GET request to the getProductById endpoint of the Vue Storefront API Middleware. In turn, it receives data from the BigCommerce getProductById GraphQL API.
Signature
declare function getProductById(
props: index_d_exports$1.GetProductByIdParameters,
options?: MethodOptions
): Promise<index_d_exports$1.ProductResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | index_d_exports$1.GetProductByIdParameters | 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 product = await sdk.bigcommerce.getProductById({ entityId: 77 });