@epcc-sdk/sdks-shopper
v0.0.42
Published
Below you'll find instructions on how to install, set up, and use the client, along with a list of available operations.
Readme
@epcc-sdk/sdks-shopper SDK
Below you'll find instructions on how to install, set up, and use the client, along with a list of available operations.
Authentication (Browser)
The SDK includes built-in authentication support for browser environments using Elastic Path's implicit authentication flow. It handles token management, automatic refresh, and storage.
Quick Start
Note: This authentication mechanism is designed for browser environments where state persistence (localStorage, cookies) is available. The built-in storage adapters and cross-tab synchronization features require browser APIs.
import { configureClient } from "@epcc-sdk/sdks-shopper/auth/configure-client";
// Configure the singleton client with authentication
configureClient(
{
baseUrl: "https://useast.api.elasticpath.com"
},
{
clientId: "your-client-id",
storage: "localStorage" // or "cookie" or custom adapter
}
);Storage Options
- localStorage (default): Tokens stored in browser localStorage with cross-tab synchronization
- cookie: Tokens stored in JavaScript-readable cookies
- Custom adapter: Implement your own storage mechanism
// Cookie storage with options
configureClient(config, {
clientId: "your-client-id",
storage: "cookie",
cookie: {
sameSite: "Strict",
secure: true,
maxAge: 3600 // 1 hour
}
});Creating Standalone Clients
For multiple stores or isolated instances:
import { createShopperClient } from "@epcc-sdk/sdks-shopper";
const { client, auth } = createShopperClient(
{ baseUrl: "https://useast.api.elasticpath.com" },
{ clientId: "your-client-id" }
);Manual Auth Control
Access the underlying auth instance for manual control:
const { client, auth } = configureClient(config, authOptions);
// Check authentication status
if (auth.isAuthenticated()) {
console.log("Authenticated!");
}
// Manually clear tokens
auth.clearToken();Features
- Automatic token refresh: Refreshes expired tokens automatically
- Request retry: Retries failed requests once after refreshing token
- Cross-tab sync: localStorage adapter syncs auth state across browser tabs
- Type-safe: Full TypeScript support with proper types
- Flexible storage: Built-in adapters or bring your own
React Query Support
This SDK provides optional React Query hooks for React applications. To use them, you need to:
Install
@tanstack/react-queryas a peer dependency:npm install @tanstack/react-query # or pnpm install @tanstack/react-query # or yarn add @tanstack/react-queryImport hooks from the
/react-querysubpath:import { useGetByContextProduct } from "@epcc-sdk/sdks-shopper/react-query";
Note: If you're not using React or React Query, you can use the SDK without installing @tanstack/react-query. The main exports work independently.
Features
- type-safe response data and errors
- response data validation and transformation
- access to the original request and response
- granular request and response customization options
- minimal learning curve thanks to extending the underlying technology
Installation
npm install @epcc-sdk/sdks-shopper
# or
pnpm install @epcc-sdk/sdks-shopper
# or
yarn add @epcc-sdk/sdks-shopperClient Usage
Clients are responsible for sending the actual HTTP requests.
The Fetch client is built as a thin wrapper on top of Fetch API, extending its functionality. If you're already familiar with Fetch, configuring your client will feel like working directly with Fetch API.
You can configure the client in two ways:
- Configuring the internal
clientinstance directly - Using the
createClientfunction
When using the operation function to make requests, by default the global client will be used unless another is provided.
1. Configure the internal client instance directly
This is the simpler approach. You can call the setConfig() method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to setConfig(), and even your own Fetch implementation.
import { client } from "@epcc-sdk/sdks-shopper";
client.setConfig({
// set default base url for requests
baseUrl: 'https://euwest.api.elasticpath.com',
// set default headers for requests
headers: {
Authorization: 'Bearer YOUR_AUTH_TOKEN',
},
});The disadvantage of this approach is that your code may call the client instance before it's configured for the first time. Depending on your use case, you might need to use the second approach.
2. Using the createClient function
This is useful when you want to use a different instance of the client for different parts of your application or when you want to use different configurations for different parts of your application.
import { createClient } from "@epcc-sdk/sdks-shopper";
// Create the client with your API base URL.
const client = createClient({
// set default base url for requests
baseUrl: "https://euwest.api.elasticpath.com",
/**
* Set default headers only for requests made by this client.
*/
headers: {
"Custom-Header": 'My Value',
},
});You can also pass this instance to any SDK function through the client option. This will override the default instance from `import { client } from "@epcc-sdk/sdks-shopper>".
const response = await getByContextProduct({
client: myClient,
});Direct configuration
Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases.
const response = await getByContextProduct({
baseUrl: 'https://example.com', // <-- override default configuration
});Interceptors (Middleware)
Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. They can be added with use and removed with eject. Below is an example request interceptor
import { client } from "@epcc-sdk/sdks-shopper";
// Supports async functions
client.interceptors.request.use(async (request) => {
// do something
return request;
});
client.interceptors.request.eject((request) => {
// do something
return request;
});
and an example response interceptor
import { client } from "@epcc-sdk/sdks-shopper";
client.interceptors.response.use((response) => {
// do something
return response;
});
client.interceptors.response.eject((response) => {
// do something
return response;
});Tip: To eject, you must provide a reference to the function that was passed to use().
Authentication
We are working to provide helpers to handle auth easier for you but for now using an interceptor is the easiest method.
import { client } from "@epcc-sdk/sdks-shopper";
client.interceptors.request.use((request, options) => {
request.headers.set('Authorization', 'Bearer MY_TOKEN');
return request;
});Build URL
If you need to access the compiled URL, you can use the buildUrl() method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.
type FooData = {
path: {
fooId: number;
};
query?: {
bar?: string;
};
url: '/foo/{fooId}';
};
const url = client.buildUrl<FooData>({
path: {
fooId: 1,
},
query: {
bar: 'baz',
},
url: '/foo/{fooId}',
});
console.log(url); // prints '/foo/1?bar=baz'Operation Usage
The following examples demonstrate how to use the operation function to make requests.
import { getByContextProduct } from "@epcc-sdk/sdks-shopper";
const product = await getByContextProduct({
// client: localClient, // optional if you have a client instance you want to use otherwise the global client will be used
path: {
...
},
query: {
...
},
});Available Operations
getByContextRelease
Endpoint: GET /catalog
Summary: Get the catalog release as shoppers
Description: Returns a list of all published releases of the specified catalog.
TypeScript Example:
import { getByContextRelease, type GetByContextReleaseData, type GetByContextReleaseResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextReleaseData = {
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextReleaseResponse = await getByContextRelease(params);getByContextAllHierarchies
Endpoint: GET /catalog/hierarchies
Summary: Get all Hierarchies
Description: Retrieves all hierarchies from a catalog based on the best matching rule for the shopper's context. Supports filtering by attributes like name and ID using operators like Eq and In.
TypeScript Example:
import { getByContextAllHierarchies, type GetByContextAllHierarchiesData, type GetByContextAllHierarchiesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextAllHierarchiesData = {
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextAllHierarchiesResponse = await getByContextAllHierarchies(params);getByContextHierarchy
Endpoint: GET /catalog/hierarchies/{hierarchy_id}
Summary: Get a Hierarchy
Description: Retrieves a specific hierarchy from the catalog based on the provided hierarchy ID. The API uses catalog rules to determine the best match for the shopper's context.
TypeScript Example:
import { getByContextHierarchy, type GetByContextHierarchyData, type GetByContextHierarchyResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextHierarchyData = {
path: {
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextHierarchyResponse = await getByContextHierarchy(params);getByContextHierarchyNodes
Endpoint: GET /catalog/hierarchies/{hierarchy_id}/nodes
Summary: Get a Hierarchy's Nodes
Description: Retrieves all nodes associated with a specified hierarchy, allowing for filtering by attributes like name and ID. Useful for improving store search functionality.
TypeScript Example:
import { getByContextHierarchyNodes, type GetByContextHierarchyNodesData, type GetByContextHierarchyNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextHierarchyNodesData = {
path: {
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextHierarchyNodesResponse = await getByContextHierarchyNodes(params);getByContextHierarchyChildNodes
Endpoint: GET /catalog/hierarchies/{hierarchy_id}/children
Summary: Get a Hierarchy's Children
Description: Retrieves the parent nodes for a specified hierarchy, allowing users to identify the hierarchy associated with a node.
TypeScript Example:
import { getByContextHierarchyChildNodes, type GetByContextHierarchyChildNodesData, type GetByContextHierarchyChildNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextHierarchyChildNodesData = {
path: {
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextHierarchyChildNodesResponse = await getByContextHierarchyChildNodes(params);getByContextAllNodes
Endpoint: GET /catalog/nodes
Summary: Get all Nodes
Description: Retrieves all nodes in the catalog based on the shopper's context, allowing for filtering by attributes like name or ID. Products associated with nodes are listed, including curated products for promoting specific items.
TypeScript Example:
import { getByContextAllNodes, type GetByContextAllNodesData, type GetByContextAllNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextAllNodesData = {
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextAllNodesResponse = await getByContextAllNodes(params);getByContextNode
Endpoint: GET /catalog/nodes/{node_id}
Summary: Get a Node
Description: Retrieves a node from the catalog, displaying associated products. Curated products are prioritized and can be managed for unique product collections.
TypeScript Example:
import { getByContextNode, type GetByContextNodeData, type GetByContextNodeResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextNodeData = {
path: {
node_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextNodeResponse = await getByContextNode(params);getByContextChildNodes
Endpoint: GET /catalog/nodes/{node_id}/relationships/children
Summary: Get a Node's Children
Description: Retrieves child nodes and associated products for a specific node in the catalog, allowing for filtering by name, slug, or ID. Supports product curation and displays curated products first if configured.
TypeScript Example:
import { getByContextChildNodes, type GetByContextChildNodesData, type GetByContextChildNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextChildNodesData = {
path: {
node_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextChildNodesResponse = await getByContextChildNodes(params);getByContextAllProducts
Endpoint: GET /catalog/products
Summary: Get all Products
Description: This operation retrieves a list of products from the catalog, including only products in a live status. It allows filtering by attributes like name, SKU, and product type.
TypeScript Example:
import { getByContextAllProducts, type GetByContextAllProductsData, type GetByContextAllProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextAllProductsData = {
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextAllProductsResponse = await getByContextAllProducts(params);getByContextProduct
Endpoint: GET /catalog/products/{product_id}
Summary: Get a Product
Description: Retrieves a specified product from the catalog in 'live' status, using the best matching catalog rule for the shopper's context. Includes options to retrieve associated component products, main images, and files.
TypeScript Example:
import { getByContextProduct, type GetByContextProductData, type GetByContextProductResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextProductData = {
path: {
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextProductResponse = await getByContextProduct(params);getByContextAllRelatedProducts
Endpoint: GET /catalog/products/{product_id}/relationships/{custom_relationship_slug}/products
Summary: Get all Related Products of a Product
Description: Returns related products of the provided product ID from a catalog.
TypeScript Example:
import { getByContextAllRelatedProducts, type GetByContextAllRelatedProductsData, type GetByContextAllRelatedProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextAllRelatedProductsData = {
path: {
product_id: "12345678-1234-5678-9012-123456789012",
custom_relationship_slug: "product-slug",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextAllRelatedProductsResponse = await getByContextAllRelatedProducts(params);getByContextComponentProductIds
Endpoint: GET /catalog/products/{product_id}/relationships/component_products
Summary: Get a Bundle's Component Products
Description: Retrieve a list of component product IDs for a specified bundle in Product Experience Manager, allowing you to manage bundles and their associated products efficiently.
TypeScript Example:
import { getByContextComponentProductIds, type GetByContextComponentProductIdsData, type GetByContextComponentProductIdsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextComponentProductIdsData = {
path: {
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextComponentProductIdsResponse = await getByContextComponentProductIds(params);getByContextChildProducts
Endpoint: GET /catalog/products/{product_id}/relationships/children
Summary: Get a Parent Product's Child Products
Description: This operation retrieves a list of child products associated with a specified parent product in a catalog release, only returning products in a live status.
TypeScript Example:
import { getByContextChildProducts, type GetByContextChildProductsData, type GetByContextChildProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextChildProductsData = {
path: {
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"EP-Channel": "web", // OPTIONAL
"EP-Context-Tag": "header-value", // OPTIONAL
},
};
const result: GetByContextChildProductsResponse = await getByContextChildProducts(params);getByContextProductsForHierarchy
Endpoint: GET /catalog/hierarchies/{hierarchy_id}/products
Summary: Get a Hierarchy's Products
Description: Retrieve live products associated with a specified hierarchy in the catalog. Filter products by attributes like name, SKU, or product type. Include component products, main images, and files using the include parameter.
TypeScript Example:
import { getByContextProductsForHierarchy, type GetByContextProductsForHierarchyData, type GetByContextProductsForHierarchyResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextProductsForHierarchyData = {
path: {
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextProductsForHierarchyResponse = await getByContextProductsForHierarchy(params);getByContextProductsForNode
Endpoint: GET /catalog/nodes/{node_id}/relationships/products
Summary: Get a Node's Products
Description: Retrieve products associated with a specified hierarchy node in the catalog, filtered by live status and curated order. Supports filtering by attributes like name, SKU, and product type.
TypeScript Example:
import { getByContextProductsForNode, type GetByContextProductsForNodeData, type GetByContextProductsForNodeResponse } from "@epcc-sdk/sdks-shopper";
const params: GetByContextProductsForNodeData = {
path: {
node_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
};
const result: GetByContextProductsForNodeResponse = await getByContextProductsForNode(params);configureByContextProduct
Endpoint: POST /catalog/products/{product_id}/configure
Summary: Configure a Shopper Bundle
Description: Configure product bundles in your catalog by allowing shoppers to select product options within specified minimum and maximum values, updating the bundle configuration with selected options and displaying them in the storefront.
TypeScript Example:
import { configureByContextProduct, type ConfigureByContextProductData, type ConfigureByContextProductResponse } from "@epcc-sdk/sdks-shopper";
const params: ConfigureByContextProductData = {
path: {
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Channel": "web", // OPTIONAL
},
body: {
data: {
type: "resource"
}
},
};
const result: ConfigureByContextProductResponse = await configureByContextProduct(params);getCatalogs
Endpoint: GET /catalogs
Summary: Gets all authorized catalogs
Description: Retrieves a list of authorized catalogs, showing differences between consecutive releases and indicating whether a full refresh is needed before publishing. Supports filtering by name.
TypeScript Example:
import { getCatalogs, type GetCatalogsData, type GetCatalogsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetCatalogsData = {
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
};
const result: GetCatalogsResponse = await getCatalogs(params);createCatalog
Endpoint: POST /catalogs
Summary: Creates a new catalog
Description: Create a catalog by defining hierarchies, products, and price books with priorities for displaying product prices. Up to five price books can be specified for different scenarios.
TypeScript Example:
import { createCatalog, type CreateCatalogData, type CreateCatalogResponse } from "@epcc-sdk/sdks-shopper";
const params: CreateCatalogData = {
body: {
data: {
type: "resource",
attributes: {
name: "Resource Name",
description: "Resource Description"
}
}
},
};
const result: CreateCatalogResponse = await createCatalog(params);deleteCatalogById
Endpoint: DELETE /catalogs/{catalog_id}
Summary: Deletes a catalog
Description: Deletes an unpublished catalog by its unique ID. Use other endpoints to delete releases or update associated catalog rules beforehand.
TypeScript Example:
import { deleteCatalogById, type DeleteCatalogByIdData, type DeleteCatalogByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteCatalogByIdData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: DeleteCatalogByIdResponse = await deleteCatalogById(params);getCatalogById
Endpoint: GET /catalogs/{catalog_id}
Summary: Get a catalog by ID
Description: Retrieves the specified catalog.
TypeScript Example:
import { getCatalogById, type GetCatalogByIdData, type GetCatalogByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: GetCatalogByIdData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: GetCatalogByIdResponse = await getCatalogById(params);updateCatalog
Endpoint: PUT /catalogs/{catalog_id}
Summary: Updates a catalog
Description: Update specific attributes of a catalog by providing new values, while keeping existing attributes unchanged. If no attributes are specified, the catalog will not be updated.
TypeScript Example:
import { updateCatalog, type UpdateCatalogData, type UpdateCatalogResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateCatalogData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
body: {
data: {
type: "resource",
attributes: {
name: "Resource Name",
description: "Resource Description"
}
}
},
};
const result: UpdateCatalogResponse = await updateCatalog(params);deleteReleases
Endpoint: DELETE /catalogs/{catalog_id}/releases
Summary: Deletes all releases
Description: Deletes all releases of the specified published catalog.
TypeScript Example:
import { deleteReleases, type DeleteReleasesData, type DeleteReleasesResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteReleasesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: DeleteReleasesResponse = await deleteReleases(params);getReleases
Endpoint: GET /catalogs/{catalog_id}/releases
Summary: Gets all authorized catalog releases
Description: This operation retrieves a list of published releases for a specified catalog, allowing users to view differences between consecutive releases using the delta link. The is_full_delta attribute helps determine if a full refresh of data is needed before publishing a catalog release.
TypeScript Example:
import { getReleases, type GetReleasesData, type GetReleasesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetReleasesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetReleasesResponse = await getReleases(params);publishRelease
Endpoint: POST /catalogs/{catalog_id}/releases
Summary: Publishes a catalog
Description: Publish a catalog to make it available for retrieval in an organization or store. Published catalogs are read-only and changes require republishing. Delta links provide differences between catalog releases for updating search integration.
TypeScript Example:
import { publishRelease, type PublishReleaseData, type PublishReleaseResponse } from "@epcc-sdk/sdks-shopper";
const params: PublishReleaseData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
},
body: {
data: {
type: "resource"
}
},
};
const result: PublishReleaseResponse = await publishRelease(params);deleteReleaseById
Endpoint: DELETE /catalogs/{catalog_id}/releases/{release_id}
Summary: Deletes a release
Description: Deletes the specified published catalog release.
TypeScript Example:
import { deleteReleaseById, type DeleteReleaseByIdData, type DeleteReleaseByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteReleaseByIdData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: DeleteReleaseByIdResponse = await deleteReleaseById(params);getReleaseById
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}
Summary: Get a catalog release by ID
Description: Retrieves the specified catalog release.
TypeScript Example:
import { getReleaseById, type GetReleaseByIdData, type GetReleaseByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: GetReleaseByIdData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetReleaseByIdResponse = await getReleaseById(params);getRules
Endpoint: GET /catalogs/rules
Summary: Gets all authorized catalog rules
Description: This operation retrieves all authorized catalog rules and supports filtering by attributes like id, catalog_id, account_ids, customer_ids, channels, and tags using operators like eq and in.
TypeScript Example:
import { getRules, type GetRulesData, type GetRulesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetRulesData = {
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
};
const result: GetRulesResponse = await getRules(params);createRule
Endpoint: POST /catalogs/rules
Summary: Creates a new catalog rule
Description: Create catalog rule resources to display different catalogs to specific shoppers based on custom criteria, such as preferred pricing or device type. Note that there may be a 5-minute delay in displaying catalogs due to caching, and organization catalogs cannot have rules applied.
TypeScript Example:
import { createRule, type CreateRuleData, type CreateRuleResponse } from "@epcc-sdk/sdks-shopper";
const params: CreateRuleData = {
body: {
data: {
type: "resource",
attributes: {
name: "Resource Name",
description: "Resource Description"
}
}
},
};
const result: CreateRuleResponse = await createRule(params);deleteRuleById
Endpoint: DELETE /catalogs/rules/{catalog_rule_id}
Summary: Deletes a catalog rule
Description: DELETE operation
TypeScript Example:
import { deleteRuleById, type DeleteRuleByIdData, type DeleteRuleByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteRuleByIdData = {
path: {
catalog_rule_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: DeleteRuleByIdResponse = await deleteRuleById(params);getRuleById
Endpoint: GET /catalogs/rules/{catalog_rule_id}
Summary: Get a catalog rule by ID
Description: GET operation
TypeScript Example:
import { getRuleById, type GetRuleByIdData, type GetRuleByIdResponse } from "@epcc-sdk/sdks-shopper";
const params: GetRuleByIdData = {
path: {
catalog_rule_id: "12345678-1234-5678-9012-123456789012",
},
};
const result: GetRuleByIdResponse = await getRuleById(params);updateRule
Endpoint: PUT /catalogs/rules/{catalog_rule_id}
Summary: Updates a catalog rule
Description: Update specific attributes of a catalog rule by providing new values. If the attributes section is empty, the catalog rule will not be updated.
TypeScript Example:
import { updateRule, type UpdateRuleData, type UpdateRuleResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateRuleData = {
path: {
catalog_rule_id: "12345678-1234-5678-9012-123456789012",
},
body: {
data: {
type: "resource",
attributes: {
name: "Resource Name",
description: "Resource Description"
}
}
},
};
const result: UpdateRuleResponse = await updateRule(params);getAllHierarchies
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies
Summary: Get all Hierarchies
Description: Retrieves hierarchies from a published catalog, limited to the current release and two prior releases. Supports filtering by attributes like name and ID.
TypeScript Example:
import { getAllHierarchies, type GetAllHierarchiesData, type GetAllHierarchiesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetAllHierarchiesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetAllHierarchiesResponse = await getAllHierarchies(params);getHierarchy
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}
Summary: Get a Hierarchy
Description: Retrieve a specific hierarchy from a published catalog, limited to the current release and two prior releases.
TypeScript Example:
import { getHierarchy, type GetHierarchyData, type GetHierarchyResponse } from "@epcc-sdk/sdks-shopper";
const params: GetHierarchyData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetHierarchyResponse = await getHierarchy(params);getHierarchyNodes
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes
Summary: Get a Hierarchy's Nodes
Description: Retrieves all nodes for a specified hierarchy from a published catalog, allowing identification of parent nodes for improved store search functionality.
TypeScript Example:
import { getHierarchyNodes, type GetHierarchyNodesData, type GetHierarchyNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetHierarchyNodesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetHierarchyNodesResponse = await getHierarchyNodes(params);getHierarchyChildNodes
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children
Summary: Get a Hierarchy's Children
Description: Retrieves parent nodes for a specified hierarchy in a published catalog, allowing identification of associated parent nodes for improved store search functionality.
TypeScript Example:
import { getHierarchyChildNodes, type GetHierarchyChildNodesData, type GetHierarchyChildNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetHierarchyChildNodesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetHierarchyChildNodesResponse = await getHierarchyChildNodes(params);getAllNodes
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/nodes
Summary: Get all Nodes
Description: Retrieves child nodes from a published catalog, limited to the current release and two prior releases. Useful for displaying product associations in a hierarchical structure.
TypeScript Example:
import { getAllNodes, type GetAllNodesData, type GetAllNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetAllNodesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetAllNodesResponse = await getAllNodes(params);getNode
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}
Summary: Get a Node
Description: Retrieves a node from a published catalog, showing associated products. Curated products can be highlighted for promotion within the hierarchy.
TypeScript Example:
import { getNode, type GetNodeData, type GetNodeResponse } from "@epcc-sdk/sdks-shopper";
const params: GetNodeData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
node_id: "12345678-1234-5678-9012-123456789012",
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetNodeResponse = await getNode(params);getChildNodes
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children
Summary: Get a Node's Children
Description: Retrieves child nodes associated with a specific node in a published catalog, allowing for the display of products and curated products in a hierarchy structure.
TypeScript Example:
import { getChildNodes, type GetChildNodesData, type GetChildNodesResponse } from "@epcc-sdk/sdks-shopper";
const params: GetChildNodesData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
node_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetChildNodesResponse = await getChildNodes(params);getAllProducts
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/products
Summary: Get all Products
Description: This operation retrieves products from a published catalog, limited to the current release and two prior releases, with only products in a 'live' status being returned.
TypeScript Example:
import { getAllProducts, type GetAllProductsData, type GetAllProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetAllProductsData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetAllProductsResponse = await getAllProducts(params);getProduct
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}
Summary: Get a Product
Description: Retrieves a live product from a published catalog within the current release and two prior releases. Includes options to retrieve associated resources like main image and files.
TypeScript Example:
import { getProduct, type GetProductData, type GetProductResponse } from "@epcc-sdk/sdks-shopper";
const params: GetProductData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetProductResponse = await getProduct(params);getAllRelatedProducts
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/{custom_relationship_slug}/products
Summary: Get all Related Products of a Product
Description: Returns related products of the provided product ID from a published catalog.
TypeScript Example:
import { getAllRelatedProducts, type GetAllRelatedProductsData, type GetAllRelatedProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetAllRelatedProductsData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
product_id: "12345678-1234-5678-9012-123456789012",
custom_relationship_slug: "product-slug",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetAllRelatedProductsResponse = await getAllRelatedProducts(params);getComponentProductIds
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products
Summary: Get a Bundle's Component Products
Description: Get a list of component product IDs for a specified bundle in Product Experience Manager, including key attributes like SKU or slug. Use the include parameter to retrieve additional resources like main images and files.
TypeScript Example:
import { getComponentProductIds, type GetComponentProductIdsData, type GetComponentProductIdsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetComponentProductIdsData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"page[limit]": 10, // OPTIONAL
"page[offset]": 0, // OPTIONAL
},
headers: {
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetComponentProductIdsResponse = await getComponentProductIds(params);getChildProducts
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children
Summary: Get a Parent Product's Child Products
Description: Retrieves a list of child products for a specified parent product in a catalog release, only including products in a live status. Non-base products will result in a 422 Unprocessable Entity response.
TypeScript Example:
import { getChildProducts, type GetChildProductsData, type GetChildProductsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetChildProductsData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
product_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
"accept-language": "en-US", // OPTIONAL
},
};
const result: GetChildProductsResponse = await getChildProducts(params);getProductsForHierarchy
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products
Summary: Get a Hierarchy's Products
Description: Retrieve products associated with a specified hierarchy in a catalog, limited to those in 'live' status. Supports filtering by various attributes like name, SKU, and product type.
TypeScript Example:
import { getProductsForHierarchy, type GetProductsForHierarchyData, type GetProductsForHierarchyResponse } from "@epcc-sdk/sdks-shopper";
const params: GetProductsForHierarchyData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
hierarchy_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetProductsForHierarchyResponse = await getProductsForHierarchy(params);getProductsForNode
Endpoint: GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products
Summary: Get a Node's Products
Description: Retrieves live products associated with a specified node in a catalog, ordered by curation if applicable. Supports filtering by attributes like name, SKU, and product type.
TypeScript Example:
import { getProductsForNode, type GetProductsForNodeData, type GetProductsForNodeResponse } from "@epcc-sdk/sdks-shopper";
const params: GetProductsForNodeData = {
path: {
catalog_id: "12345678-1234-5678-9012-123456789012",
release_id: "12345678-1234-5678-9012-123456789012",
node_id: "12345678-1234-5678-9012-123456789012",
},
query: {
"filter": "eq(name,\"Product Name\")", // OPTIONAL
"include": ["files", "main_images"], // OPTIONAL
"page[limit]": 10, // OPTIONAL
},
headers: {
"accept-language": "en-US", // OPTIONAL
"EP-Pricebook-IDs-For-Price-Segmentation-Preview": "header-value", // OPTIONAL
},
};
const result: GetProductsForNodeResponse = await getProductsForNode(params);getCarts
Endpoint: GET /v2/carts
Summary: Get Shopper Carts
Description: Retrieve carts associated with an account or customer, sorted by updated date in descending order. Requires an implicit token for authentication.
TypeScript Example:
import { getCarts, type GetCartsData, type GetCartsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetCartsData = {
headers: {
"x-moltin-customer-token": "header-value", // OPTIONAL
},
};
const result: GetCartsResponse = await getCarts(params);createACart
Endpoint: POST /v2/carts
Summary: Create a Cart
Description: Create a new cart for a customer. Each shopper can have multiple carts with distinct items. Custom discounts and inventory settings can be specified.
TypeScript Example:
import { createACart, type CreateACartData, type CreateACartResponse } from "@epcc-sdk/sdks-shopper";
const params: CreateACartData = {
headers: {
"x-moltin-customer-token": "header-value", // OPTIONAL
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: CreateACartResponse = await createACart(params);deleteACart
Endpoint: DELETE /v2/carts/{cartID}
Summary: Delete a Cart
Description: Deletes a cart, including items, name, and description. Ensure cart is disassociated from customer before deletion to avoid error.
TypeScript Example:
import { deleteACart, type DeleteACartData, type DeleteACartResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteACartData = {
path: {
cartID: "cartID",
},
};
const result: DeleteACartResponse = await deleteACart(params);getACart
Endpoint: GET /v2/carts/{cartID}
Summary: Get a Cart
Description: Retrieve a specific cart by providing the cart ID. If the cart doesn't exist, a new cart will be created. Displays associated shipping group IDs if applicable.
TypeScript Example:
import { getACart, type GetACartData, type GetACartResponse } from "@epcc-sdk/sdks-shopper";
const params: GetACartData = {
path: {
cartID: "cartID",
},
query: {
"include": ["files", "main_images"], // OPTIONAL
},
};
const result: GetACartResponse = await getACart(params);updateACart
Endpoint: PUT /v2/carts/{cartID}
Summary: Update a Cart
Description: Update properties of a specific cart by specifying custom discounts and enabling/disabling inventory checks until checkout.
TypeScript Example:
import { updateACart, type UpdateACartData, type UpdateACartResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateACartData = {
path: {
cartID: "cartID",
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: UpdateACartResponse = await updateACart(params);deleteAllCartItems
Endpoint: DELETE /v2/carts/{cartID}/items
Summary: Delete all Cart Items
Description: This operation allows a shopper to delete all custom items and promotions from their cart, while keeping the cart available for further item additions. Cart details and associations persist.
TypeScript Example:
import { deleteAllCartItems, type DeleteAllCartItemsData, type DeleteAllCartItemsResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteAllCartItemsData = {
path: {
cartID: "cartID",
},
};
const result: DeleteAllCartItemsResponse = await deleteAllCartItems(params);getCartItems
Endpoint: GET /v2/carts/{cartID}/items
Summary: Get Cart Items
Description: Retrieve cart items with associated shipping group IDs and breakdown by promotion ID, showing discounts applied using the same promotion code in both Promotions Standard and Rule Promotions.
TypeScript Example:
import { getCartItems, type GetCartItemsData, type GetCartItemsResponse } from "@epcc-sdk/sdks-shopper";
const params: GetCartItemsData = {
path: {
cartID: "cartID",
},
};
const result: GetCartItemsResponse = await getCartItems(params);manageCarts
Endpoint: POST /v2/carts/{cartID}/items
Summary: Add Items to Cart
Description: Add products, bundles, personalized items, subscriptions, and promotions to a cart. Customize items with text inputs. Specify stock locations and merge multiple carts.
TypeScript Example:
import { manageCarts, type ManageCartsData, type ManageCartsResponse } from "@epcc-sdk/sdks-shopper";
const params: ManageCartsData = {
path: {
cartID: "cartID",
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: ManageCartsResponse = await manageCarts(params);bulkUpdateItemsInCart
Endpoint: PUT /v2/carts/{cartID}/items
Summary: Bulk Update Items in Cart
Description: This operation allows shoppers to update multiple items in their cart at once, including quantity and shipping group details, saving time and enabling bulk updates.
TypeScript Example:
import { bulkUpdateItemsInCart, type BulkUpdateItemsInCartData, type BulkUpdateItemsInCartResponse } from "@epcc-sdk/sdks-shopper";
const params: BulkUpdateItemsInCartData = {
path: {
cartID: "cartID",
},
body: {
data: [
{
type: "cart_item",
quantity: 2,
sku: "PRODUCT-SKU-001"
}
]
},
};
const result: BulkUpdateItemsInCartResponse = await bulkUpdateItemsInCart(params);deleteACartItem
Endpoint: DELETE /v2/carts/{cartID}/items/{cartitemID}
Summary: Delete a Cart Item
Description: Use this endpoint to delete a cart item.
TypeScript Example:
import { deleteACartItem, type DeleteACartItemData, type DeleteACartItemResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteACartItemData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
},
};
const result: DeleteACartItemResponse = await deleteACartItem(params);updateACartItem
Endpoint: PUT /v2/carts/{cartID}/items/{cartitemID}
Summary: Update a Cart Item
Description: You can easily update a cart item. A successful update returns the cart items.
TypeScript Example:
import { updateACartItem, type UpdateACartItemData, type UpdateACartItemResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateACartItemData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: UpdateACartItemResponse = await updateACartItem(params);deleteAccountCartAssociation
Endpoint: DELETE /v2/carts/{cartID}/relationships/accounts
Summary: Delete Account Cart Association
Description: You can delete an association between an account and a cart.
TypeScript Example:
import { deleteAccountCartAssociation, type DeleteAccountCartAssociationData, type DeleteAccountCartAssociationResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteAccountCartAssociationData = {
path: {
cartID: "cartID",
},
};
const result: DeleteAccountCartAssociationResponse = await deleteAccountCartAssociation(params);createAccountCartAssociation
Endpoint: POST /v2/carts/{cartID}/relationships/accounts
Summary: Create an Account Cart Association
Description: Create associations between an account and carts, allowing the account to access those carts across devices.
TypeScript Example:
import { createAccountCartAssociation, type CreateAccountCartAssociationData, type CreateAccountCartAssociationResponse } from "@epcc-sdk/sdks-shopper";
const params: CreateAccountCartAssociationData = {
path: {
cartID: "cartID",
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: CreateAccountCartAssociationResponse = await createAccountCartAssociation(params);deleteCustomerCartAssociation
Endpoint: DELETE /v2/carts/{cartID}/relationships/customers
Summary: Delete Customer Cart Association
Description: You can delete an association between a customer and a cart.
TypeScript Example:
import { deleteCustomerCartAssociation, type DeleteCustomerCartAssociationData, type DeleteCustomerCartAssociationResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteCustomerCartAssociationData = {
path: {
cartID: "cartID",
},
headers: {
"x-moltin-customer-token": "header-value", // OPTIONAL
},
};
const result: DeleteCustomerCartAssociationResponse = await deleteCustomerCartAssociation(params);createCustomerCartAssociation
Endpoint: POST /v2/carts/{cartID}/relationships/customers
Summary: Create a Customer Cart Association
Description: Create associations between a customer and one or more carts, allowing the customer to access those carts across devices.
TypeScript Example:
import { createCustomerCartAssociation, type CreateCustomerCartAssociationData, type CreateCustomerCartAssociationResponse } from "@epcc-sdk/sdks-shopper";
const params: CreateCustomerCartAssociationData = {
path: {
cartID: "cartID",
},
headers: {
"x-moltin-customer-token": "header-value", // OPTIONAL
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: CreateCustomerCartAssociationResponse = await createCustomerCartAssociation(params);deleteAPromotionViaPromotionCode
Endpoint: DELETE /v2/carts/{cartID}/discounts/{promoCode}
Summary: Delete a Promotion via Promotion Code
Description: You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically.
TypeScript Example:
import { deleteAPromotionViaPromotionCode, type DeleteAPromotionViaPromotionCodeData, type DeleteAPromotionViaPromotionCodeResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteAPromotionViaPromotionCodeData = {
path: {
cartID: "cartID",
promoCode: "promoCode",
},
};
const result: DeleteAPromotionViaPromotionCodeResponse = await deleteAPromotionViaPromotionCode(params);addTaxItemToCart
Endpoint: POST /v2/carts/{cartID}/items/{cartitemID}/taxes
Summary: Add Tax Item to Cart
Description: Use this endpoint to add a tax item to a cart.
:::note
There is a soft limit of 5 unique tax items per cart item at any one time.
:::
TypeScript Example:
import { addTaxItemToCart, type AddTaxItemToCartData, type AddTaxItemToCartResponse } from "@epcc-sdk/sdks-shopper";
const params: AddTaxItemToCartData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
},
body: {
data: {
type: "custom_discount",
name: "Discount Name",
amount: {
amount: 1000,
currency: "USD"
}
}
},
};
const result: AddTaxItemToCartResponse = await addTaxItemToCart(params);bulkDeleteTaxItemsFromCart
Endpoint: DELETE /v2/carts/{cartID}/taxes
Summary: Bulk Delete Tax Items from Cart
Description: Use this endpoint to bulk delete tax items from cart.
TypeScript Example:
import { bulkDeleteTaxItemsFromCart, type BulkDeleteTaxItemsFromCartData, type BulkDeleteTaxItemsFromCartResponse } from "@epcc-sdk/sdks-shopper";
const params: BulkDeleteTaxItemsFromCartData = {
path: {
cartID: "cartID",
},
};
const result: BulkDeleteTaxItemsFromCartResponse = await bulkDeleteTaxItemsFromCart(params);bulkAddTaxItemsToCart
Endpoint: POST /v2/carts/{cartID}/taxes
Summary: Bulk Add Tax Items to Cart
Description: This operation allows users to bulk add tax items to a specific cart, with a maximum limit of five tax items per cart item. Errors are returned for exceeding the limit or mismatching item types.
TypeScript Example:
import { bulkAddTaxItemsToCart, type BulkAddTaxItemsToCartData, type BulkAddTaxItemsToCartResponse } from "@epcc-sdk/sdks-shopper";
const params: BulkAddTaxItemsToCartData = {
path: {
cartID: "cartID",
},
body: {
data: [
{
type: "cart_item",
quantity: 2,
sku: "PRODUCT-SKU-001"
}
]
},
};
const result: BulkAddTaxItemsToCartResponse = await bulkAddTaxItemsToCart(params);deleteATaxItem
Endpoint: DELETE /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}
Summary: Delete a Tax Item
Description: Use this endpoint to delete a tax item.
TypeScript Example:
import { deleteATaxItem, type DeleteATaxItemData, type DeleteATaxItemResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteATaxItemData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
taxitemID: "taxitemID",
},
};
const result: DeleteATaxItemResponse = await deleteATaxItem(params);updateATaxItem
Endpoint: PUT /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}
Summary: Update a Tax Item
Description: Use this endpoint to update a tax item. To change tax value from rate to amount, set rate to null, then set amount value and vice versa.
TypeScript Example:
import { updateATaxItem, type UpdateATaxItemData, type UpdateATaxItemResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateATaxItemData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
taxitemID: "taxitemID",
},
body: {
data: {
type: "resource",
attributes: {
name: "Resource Name",
description: "Resource Description"
}
}
},
};
const result: UpdateATaxItemResponse = await updateATaxItem(params);bulkDeleteCustomDiscountsFromCart
Endpoint: DELETE /v2/carts/{cartID}/custom-discounts
Summary: Bulk Delete Custom Discounts From Cart
Description: Use this endpoint to bulk delete custom discounts from cart.
TypeScript Example:
import { bulkDeleteCustomDiscountsFromCart, type BulkDeleteCustomDiscountsFromCartData, type BulkDeleteCustomDiscountsFromCartResponse } from "@epcc-sdk/sdks-shopper";
const params: BulkDeleteCustomDiscountsFromCartData = {
path: {
cartID: "cartID",
},
};
const result: BulkDeleteCustomDiscountsFromCartResponse = await bulkDeleteCustomDiscountsFromCart(params);bulkAddCustomDiscountsToCart
Endpoint: POST /v2/carts/{cartID}/custom-discounts
Summary: Bulk Add Custom Discounts to Cart
Description: This operation allows users to add custom discounts in bulk to a specific cart by setting a default value of 5 if not configured, with the option to increase the value by contacting Elastic Path Support team.
TypeScript Example:
import { bulkAddCustomDiscountsToCart, type BulkAddCustomDiscountsToCartData, type BulkAddCustomDiscountsToCartResponse } from "@epcc-sdk/sdks-shopper";
const params: BulkAddCustomDiscountsToCartData = {
path: {
cartID: "cartID",
},
body: {
data: [
{
type: "cart_item",
quantity: 2,
sku: "PRODUCT-SKU-001"
}
]
},
};
const result: BulkAddCustomDiscountsToCartResponse = await bulkAddCustomDiscountsToCart(params);deleteCustomDiscountFromCart
Endpoint: DELETE /v2/carts/{cartID}/custom-discounts/{customdiscountID}
Summary: Delete Custom Discount From Cart
Description: Use this endpoint to delete custom discount from cart.
TypeScript Example:
import { deleteCustomDiscountFromCart, type DeleteCustomDiscountFromCartData, type DeleteCustomDiscountFromCartResponse } from "@epcc-sdk/sdks-shopper";
const params: DeleteCustomDiscountFromCartData = {
path: {
cartID: "cartID",
customdiscountID: "customdiscountID",
},
};
const result: DeleteCustomDiscountFromCartResponse = await deleteCustomDiscountFromCart(params);updateCustomDiscountForCart
Endpoint: PUT /v2/carts/{cartID}/custom-discounts/{customdiscountID}
Summary: Update Custom Discount For Cart
Description: Use this endpoint to update a custom discount in your cart.
TypeScript Example:
import { updateCustomDiscountForCart, type UpdateCustomDiscountForCartData, type UpdateCustomDiscountForCartResponse } from "@epcc-sdk/sdks-shopper";
const params: UpdateCustomDiscountForCartData = {
path: {
cartID: "cartID",
customdiscountID: "customdiscountID",
},
body: {
data: {
type: "cart_item",
quantity: 1,
sku: "PRODUCT-SKU-001"
}
},
};
const result: UpdateCustomDiscountForCartResponse = await updateCustomDiscountForCart(params);addCustomDiscountToCartItem
Endpoint: POST /v2/carts/{cartID}/items/{cartitemID}/custom-discounts
Summary: Add Custom Discount To Cart Item
Description: Use this endpoint to add a custom discount to cart item.
TypeScript Example:
import { addCustomDiscountToCartItem, type AddCustomDiscountToCartItemData, type AddCustomDiscountToCartItemResponse } from "@epcc-sdk/sdks-shopper";
const params: AddCustomDiscountToCartItemData = {
path: {
cartID: "cartID",
cartitemID: "cartitemID",
},
body: {
data: {
type: "custom_discount",
name: "Discount Name",
amount: {
amount: 1000,
currency: "USD"
}
}
},
};
const result: AddCustomDiscountToCartItemResponse = await addCustomDiscountToCartItem(params);deleteCustomDiscountFromCartItem
Endpoint: DELETE /v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}
Summary: Delete Custom Discount From Cart Item
*Description:
