Skip to main content

Products

The product methods for fetching data related to your product catalog.

All requests to the Product CDN are cached. The caller must call the resetCDNCache function to clear it and fetch updated data.

getCDNProduct v1.0.0 Types

Returns a product by external product id.

As of version 1.8.0 this function now supports both version 2020-12 and 2022-06. By default it will return 2020-12, however it can now take an optional query object as a second argument. You can pass { version: '2022-06' } as the second argument to get the the 2022-06 version returned.

import { getCDNProduct } from '@rechargeapps/storefront-client';
await getCDNProduct(externalProductId);

await getCDNProduct(externalProductId, { version: '2020-12' });
await getCDNProduct(externalProductId, { version: '2022-06' });

getCDNProducts v1.0.0 Types

Returns all products for your store.

This call allows you to get all your products. However if there are too many products and the payload is too large this will return with an error of too many products requiring you to fetch products one at a time.

import { getCDNProducts } from '@rechargeapps/storefront-client';
await getCDNProducts();