@epcc-sdk/sdks-shopper 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/client/@tanstack/react-query.gen.d.ts +1498 -0
- package/dist/client/@tanstack/react-query.gen.js +1915 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +3 -0
- package/dist/client/sdk.gen.d.ts +2002 -0
- package/dist/client/sdk.gen.js +2649 -0
- package/dist/client/transformers.gen.d.ts +40 -0
- package/dist/client/transformers.gen.js +545 -0
- package/dist/client/types.gen.d.ts +6003 -0
- package/dist/client/types.gen.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/utils/extract-product-image.d.ts +2 -0
- package/dist/utils/extract-product-image.js +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,2649 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
import { createClient, createConfig } from "@hey-api/client-fetch";
|
|
14
|
+
export var client = createClient(createConfig());
|
|
15
|
+
/**
|
|
16
|
+
* Get the catalog release as shoppers
|
|
17
|
+
* Returns a list of all published releases of the specified catalog.
|
|
18
|
+
*/
|
|
19
|
+
export var getByContextRelease = function (options) {
|
|
20
|
+
var _a;
|
|
21
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
22
|
+
{
|
|
23
|
+
scheme: "bearer",
|
|
24
|
+
type: "http",
|
|
25
|
+
},
|
|
26
|
+
], url: "/catalog" }));
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get all Hierarchies
|
|
30
|
+
* Returns all hierarchies from a catalog.
|
|
31
|
+
*
|
|
32
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
33
|
+
*
|
|
34
|
+
* ### Filtering
|
|
35
|
+
*
|
|
36
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering).
|
|
37
|
+
*
|
|
38
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
39
|
+
* |:--- |:--- |:--- |:--- |
|
|
40
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
41
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
42
|
+
*
|
|
43
|
+
* ### Building breadcrumbs in a storefront
|
|
44
|
+
*
|
|
45
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
46
|
+
*
|
|
47
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
48
|
+
*
|
|
49
|
+
* - Specify the node Ids in the filter expression.
|
|
50
|
+
* - You can have as many node Ids as you want.
|
|
51
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export var getByContextAllHierarchies = function (options) {
|
|
55
|
+
var _a;
|
|
56
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
57
|
+
{
|
|
58
|
+
scheme: "bearer",
|
|
59
|
+
type: "http",
|
|
60
|
+
},
|
|
61
|
+
], url: "/catalog/hierarchies" }));
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get a Hierarchy
|
|
65
|
+
* Returns a hierarchy from the catalog.
|
|
66
|
+
*
|
|
67
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules).
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
export var getByContextHierarchy = function (options) {
|
|
71
|
+
var _a;
|
|
72
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
73
|
+
{
|
|
74
|
+
scheme: "bearer",
|
|
75
|
+
type: "http",
|
|
76
|
+
},
|
|
77
|
+
], url: "/catalog/hierarchies/{hierarchy_id}" }));
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Get a Hierarchy's Nodes
|
|
81
|
+
* Returns all the nodes for the specified hierarchy.
|
|
82
|
+
*
|
|
83
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
84
|
+
*
|
|
85
|
+
* In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
86
|
+
*
|
|
87
|
+
* ### Filtering
|
|
88
|
+
*
|
|
89
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering).
|
|
90
|
+
*
|
|
91
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
92
|
+
* |:--- |:--- |:--- |:--- |
|
|
93
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
94
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
95
|
+
*
|
|
96
|
+
* ### Building breadcrumbs in a storefront
|
|
97
|
+
*
|
|
98
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
99
|
+
*
|
|
100
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
101
|
+
*
|
|
102
|
+
* - Specify the node Ids in the filter expression.
|
|
103
|
+
* - You can have as many node Ids as you want.
|
|
104
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
export var getByContextHierarchyNodes = function (options) {
|
|
108
|
+
var _a;
|
|
109
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
110
|
+
{
|
|
111
|
+
scheme: "bearer",
|
|
112
|
+
type: "http",
|
|
113
|
+
},
|
|
114
|
+
], url: "/catalog/hierarchies/{hierarchy_id}/nodes" }));
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Get a Hierarchy's Children
|
|
118
|
+
* Returns the parent nodes for the specified hierarchy.
|
|
119
|
+
*
|
|
120
|
+
* 
|
|
121
|
+
*
|
|
122
|
+
* If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
123
|
+
*
|
|
124
|
+
* In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
125
|
+
*
|
|
126
|
+
* ### Filtering
|
|
127
|
+
*
|
|
128
|
+
* The following operators and attributes are available when filtering on this endpoint.
|
|
129
|
+
*
|
|
130
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
131
|
+
* |:--- |:--- |:--- |:--- |
|
|
132
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
133
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
134
|
+
*
|
|
135
|
+
* For more information, see [Filtering](/guides/Getting-Started/filtering).
|
|
136
|
+
*
|
|
137
|
+
* ### Building breadcrumbs in a storefront
|
|
138
|
+
*
|
|
139
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
140
|
+
*
|
|
141
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
142
|
+
*
|
|
143
|
+
* - Specify the node Ids in the filter expression.
|
|
144
|
+
* - You can have as many node Ids as you want.
|
|
145
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
export var getByContextHierarchyChildNodes = function (options) {
|
|
149
|
+
var _a;
|
|
150
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
151
|
+
{
|
|
152
|
+
scheme: "bearer",
|
|
153
|
+
type: "http",
|
|
154
|
+
},
|
|
155
|
+
], url: "/catalog/hierarchies/{hierarchy_id}/children" }));
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Get all Nodes
|
|
159
|
+
* Returns all nodes in the catalog.
|
|
160
|
+
*
|
|
161
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
162
|
+
*
|
|
163
|
+
* You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
164
|
+
*
|
|
165
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront).
|
|
166
|
+
*
|
|
167
|
+
* The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront.
|
|
168
|
+
*
|
|
169
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
170
|
+
* - If a curated product is removed from a node, the product is also removed from the `curated_products` list.
|
|
171
|
+
*
|
|
172
|
+
* ### Filtering
|
|
173
|
+
*
|
|
174
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available.
|
|
175
|
+
*
|
|
176
|
+
* | Operator | Description | Attributes | Example |
|
|
177
|
+
* | --- | --- | --- | --- |
|
|
178
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` |
|
|
179
|
+
* | `in` | Checks if the values are included in the specified string. If they are, the condition is true.
|
|
180
|
+
* | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` |
|
|
181
|
+
*
|
|
182
|
+
* ### Building breadcrumbs in a storefront
|
|
183
|
+
*
|
|
184
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
185
|
+
*
|
|
186
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
187
|
+
*
|
|
188
|
+
* - Specify the node Ids in the filter expression.
|
|
189
|
+
* - You can have as many node Ids as you want.
|
|
190
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
191
|
+
*
|
|
192
|
+
*/
|
|
193
|
+
export var getByContextAllNodes = function (options) {
|
|
194
|
+
var _a;
|
|
195
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
196
|
+
{
|
|
197
|
+
scheme: "bearer",
|
|
198
|
+
type: "http",
|
|
199
|
+
},
|
|
200
|
+
], url: "/catalog/nodes" }));
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Get a Node
|
|
204
|
+
* Returns a node from the catalog.
|
|
205
|
+
*
|
|
206
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
207
|
+
*
|
|
208
|
+
* You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
209
|
+
*
|
|
210
|
+
* The response lists the products associated with a node. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront.
|
|
211
|
+
*
|
|
212
|
+
* - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first.
|
|
213
|
+
* - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time.
|
|
214
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
215
|
+
* - A product that is curated has the `"curated_product": true` attribute displayed.
|
|
216
|
+
* - If a curated product is removed from a node, the product is also removed from the `curated_products` list.
|
|
217
|
+
*
|
|
218
|
+
*/
|
|
219
|
+
export var getByContextNode = function (options) {
|
|
220
|
+
var _a;
|
|
221
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
222
|
+
{
|
|
223
|
+
scheme: "bearer",
|
|
224
|
+
type: "http",
|
|
225
|
+
},
|
|
226
|
+
], url: "/catalog/nodes/{node_id}" }));
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Get a Node's Children
|
|
230
|
+
* Returns the child nodes for a node in the catalog.
|
|
231
|
+
*
|
|
232
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
233
|
+
*
|
|
234
|
+
* You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
235
|
+
*
|
|
236
|
+
* The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront.
|
|
237
|
+
*
|
|
238
|
+
* - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first.
|
|
239
|
+
* - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time.
|
|
240
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
241
|
+
* - A product that is curated has the "curated_product": true attribute displayed.
|
|
242
|
+
* - If a curated product is removed from a node, the product is also removed from the curated_products list.
|
|
243
|
+
*
|
|
244
|
+
* ### Filtering
|
|
245
|
+
*
|
|
246
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available.
|
|
247
|
+
*
|
|
248
|
+
* | Operator | Description | Attributes | Example |
|
|
249
|
+
* | --- | --- | --- | --- |
|
|
250
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` |
|
|
251
|
+
* | `in` | Checks if the values are included in the specified string. If they are, the condition is true.
|
|
252
|
+
* | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` |
|
|
253
|
+
*
|
|
254
|
+
* ### Building breadcrumbs in a storefront
|
|
255
|
+
*
|
|
256
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
257
|
+
*
|
|
258
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
259
|
+
*
|
|
260
|
+
* - Specify the node Ids in the filter expression.
|
|
261
|
+
* - You can have as many node Ids as you want.
|
|
262
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
263
|
+
*
|
|
264
|
+
*/
|
|
265
|
+
export var getByContextChildNodes = function (options) {
|
|
266
|
+
var _a;
|
|
267
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
268
|
+
{
|
|
269
|
+
scheme: "bearer",
|
|
270
|
+
type: "http",
|
|
271
|
+
},
|
|
272
|
+
], url: "/catalog/nodes/{node_id}/relationships/children" }));
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Get all Products
|
|
276
|
+
* Retrieves the list of products from the catalog. Only the products in a live status are retrieved.
|
|
277
|
+
*
|
|
278
|
+
* ### Catalog Rules
|
|
279
|
+
*
|
|
280
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
281
|
+
*
|
|
282
|
+
* ### Product and Node Associations
|
|
283
|
+
*
|
|
284
|
+
* You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
285
|
+
*
|
|
286
|
+
*
|
|
287
|
+
* ### Including Resources
|
|
288
|
+
*
|
|
289
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
290
|
+
*
|
|
291
|
+
* | Parameter | Required | Description |
|
|
292
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
293
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
294
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
295
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
296
|
+
*
|
|
297
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
298
|
+
*
|
|
299
|
+
* ### Filtering
|
|
300
|
+
*
|
|
301
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
302
|
+
*
|
|
303
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
304
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
305
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
306
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
307
|
+
*
|
|
308
|
+
* ### Building breadcrumbs in a storefront
|
|
309
|
+
*
|
|
310
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
311
|
+
*
|
|
312
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
313
|
+
*
|
|
314
|
+
* - Specify the node Ids in the filter expression.
|
|
315
|
+
* - You can have as many node Ids as you want.
|
|
316
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
317
|
+
*
|
|
318
|
+
*/
|
|
319
|
+
export var getByContextAllProducts = function (options) {
|
|
320
|
+
var _a;
|
|
321
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
322
|
+
{
|
|
323
|
+
scheme: "bearer",
|
|
324
|
+
type: "http",
|
|
325
|
+
},
|
|
326
|
+
], url: "/catalog/products" }));
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Get a Product
|
|
330
|
+
* Returns the specified product from the catalog. The product must be in the `live` status.
|
|
331
|
+
*
|
|
332
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
333
|
+
*
|
|
334
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
335
|
+
*
|
|
336
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
337
|
+
*
|
|
338
|
+
* | Parameter | Required | Description |
|
|
339
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
340
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
341
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
342
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
343
|
+
*
|
|
344
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
345
|
+
*
|
|
346
|
+
*/
|
|
347
|
+
export var getByContextProduct = function (options) {
|
|
348
|
+
var _a;
|
|
349
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
350
|
+
{
|
|
351
|
+
scheme: "bearer",
|
|
352
|
+
type: "http",
|
|
353
|
+
},
|
|
354
|
+
], url: "/catalog/products/{product_id}" }));
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Get a Bundle's Component Products
|
|
358
|
+
* With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together.
|
|
359
|
+
*
|
|
360
|
+
* You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.
|
|
361
|
+
*
|
|
362
|
+
* This endpoint returns a list of component product IDs for the specified bundle.
|
|
363
|
+
*
|
|
364
|
+
*/
|
|
365
|
+
export var getByContextComponentProductIds = function (options) {
|
|
366
|
+
var _a;
|
|
367
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
368
|
+
{
|
|
369
|
+
scheme: "bearer",
|
|
370
|
+
type: "http",
|
|
371
|
+
},
|
|
372
|
+
], url: "/catalog/products/{product_id}/relationships/component_products" }));
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Get a Parent Product's Child Products
|
|
376
|
+
* For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved.
|
|
377
|
+
*
|
|
378
|
+
* If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
379
|
+
*
|
|
380
|
+
* You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
381
|
+
*
|
|
382
|
+
* ### Filtering
|
|
383
|
+
*
|
|
384
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
385
|
+
*
|
|
386
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
387
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
388
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
389
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
390
|
+
*
|
|
391
|
+
* ### Building breadcrumbs in a storefront
|
|
392
|
+
*
|
|
393
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
394
|
+
*
|
|
395
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
396
|
+
*
|
|
397
|
+
* - Specify the node Ids in the filter expression.
|
|
398
|
+
* - You can have as many node Ids as you want.
|
|
399
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
400
|
+
*
|
|
401
|
+
* ### Including Resources
|
|
402
|
+
*
|
|
403
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
404
|
+
*
|
|
405
|
+
* | Parameter | Required | Description |
|
|
406
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
407
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
408
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
409
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
410
|
+
*
|
|
411
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
412
|
+
*
|
|
413
|
+
*/
|
|
414
|
+
export var getByContextChildProducts = function (options) {
|
|
415
|
+
var _a;
|
|
416
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
417
|
+
{
|
|
418
|
+
scheme: "bearer",
|
|
419
|
+
type: "http",
|
|
420
|
+
},
|
|
421
|
+
], url: "/catalog/products/{product_id}/relationships/children" }));
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Get a Hierarchy's Products
|
|
425
|
+
* Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status.
|
|
426
|
+
*
|
|
427
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
428
|
+
*
|
|
429
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
430
|
+
*
|
|
431
|
+
* ### Filtering
|
|
432
|
+
*
|
|
433
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
434
|
+
*
|
|
435
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
436
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
437
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
438
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
439
|
+
*
|
|
440
|
+
* ### Building breadcrumbs in a storefront
|
|
441
|
+
*
|
|
442
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
443
|
+
*
|
|
444
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
445
|
+
*
|
|
446
|
+
* - Specify the node Ids in the filter expression.
|
|
447
|
+
* - You can have as many node Ids as you want.
|
|
448
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
449
|
+
*
|
|
450
|
+
* ### Including Resources
|
|
451
|
+
*
|
|
452
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
453
|
+
*
|
|
454
|
+
* | Parameter | Required | Description |
|
|
455
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
456
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
457
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
458
|
+
* `files` | Optional | Any files associated with a product. |
|
|
459
|
+
*
|
|
460
|
+
*
|
|
461
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
462
|
+
*
|
|
463
|
+
*/
|
|
464
|
+
export var getByContextProductsForHierarchy = function (options) {
|
|
465
|
+
var _a;
|
|
466
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
467
|
+
{
|
|
468
|
+
scheme: "bearer",
|
|
469
|
+
type: "http",
|
|
470
|
+
},
|
|
471
|
+
], url: "/catalog/hierarchies/{hierarchy_id}/products" }));
|
|
472
|
+
};
|
|
473
|
+
/**
|
|
474
|
+
* Get a Node's Products
|
|
475
|
+
* Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed.
|
|
476
|
+
*
|
|
477
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
478
|
+
*
|
|
479
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
480
|
+
*
|
|
481
|
+
* ### Filtering
|
|
482
|
+
*
|
|
483
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
484
|
+
*
|
|
485
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
486
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
487
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
488
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
489
|
+
*
|
|
490
|
+
* ### Building breadcrumbs in a storefront
|
|
491
|
+
*
|
|
492
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
493
|
+
*
|
|
494
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
495
|
+
*
|
|
496
|
+
* - Specify the node Ids in the filter expression.
|
|
497
|
+
* - You can have as many node Ids as you want.
|
|
498
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
499
|
+
*
|
|
500
|
+
* ### Including Resources
|
|
501
|
+
*
|
|
502
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
503
|
+
*
|
|
504
|
+
* | Parameter | Required | Description |
|
|
505
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
506
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
507
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
508
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
509
|
+
*
|
|
510
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
511
|
+
*
|
|
512
|
+
*/
|
|
513
|
+
export var getByContextProductsForNode = function (options) {
|
|
514
|
+
var _a;
|
|
515
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
516
|
+
{
|
|
517
|
+
scheme: "bearer",
|
|
518
|
+
type: "http",
|
|
519
|
+
},
|
|
520
|
+
], url: "/catalog/nodes/{node_id}/relationships/products" }));
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Configure a Shopper Bundle
|
|
524
|
+
* Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front.
|
|
525
|
+
*
|
|
526
|
+
* - Products must be in a `live` status.
|
|
527
|
+
* - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options.
|
|
528
|
+
*
|
|
529
|
+
* If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request.
|
|
530
|
+
*
|
|
531
|
+
* The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected.
|
|
532
|
+
*
|
|
533
|
+
* ### Including Resources
|
|
534
|
+
*
|
|
535
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
536
|
+
*
|
|
537
|
+
* | Parameter | Required | Description |
|
|
538
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
539
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
540
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
541
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
542
|
+
*
|
|
543
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
544
|
+
*
|
|
545
|
+
*/
|
|
546
|
+
export var configureByContextProduct = function (options) {
|
|
547
|
+
var _a;
|
|
548
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
549
|
+
{
|
|
550
|
+
scheme: "bearer",
|
|
551
|
+
type: "http",
|
|
552
|
+
},
|
|
553
|
+
], url: "/catalog/products/{product_id}/configure" }));
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* Gets all authorized catalogs
|
|
557
|
+
* Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint.
|
|
558
|
+
*
|
|
559
|
+
* You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release).
|
|
560
|
+
*
|
|
561
|
+
* If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published.
|
|
562
|
+
*
|
|
563
|
+
*/
|
|
564
|
+
export var getCatalogs = function (options) {
|
|
565
|
+
var _a;
|
|
566
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
567
|
+
{
|
|
568
|
+
scheme: "bearer",
|
|
569
|
+
type: "http",
|
|
570
|
+
},
|
|
571
|
+
], url: "/catalogs" }));
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* Creates a new catalog
|
|
575
|
+
* Before you create a catalog, you must define the following resources:
|
|
576
|
+
*
|
|
577
|
+
* - Hierarchies - hierarchies and nodes to categorize the products.
|
|
578
|
+
* - Products - product information, associated assets, and links to hierarchy nodes.
|
|
579
|
+
* - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority.
|
|
580
|
+
*
|
|
581
|
+
*/
|
|
582
|
+
export var createCatalog = function (options) {
|
|
583
|
+
var _a;
|
|
584
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
585
|
+
{
|
|
586
|
+
scheme: "bearer",
|
|
587
|
+
type: "http",
|
|
588
|
+
},
|
|
589
|
+
], url: "/catalogs" }));
|
|
590
|
+
};
|
|
591
|
+
/**
|
|
592
|
+
* Deletes a catalog
|
|
593
|
+
* Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog.
|
|
594
|
+
*/
|
|
595
|
+
export var deleteCatalogById = function (options) {
|
|
596
|
+
var _a;
|
|
597
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
598
|
+
{
|
|
599
|
+
scheme: "bearer",
|
|
600
|
+
type: "http",
|
|
601
|
+
},
|
|
602
|
+
], url: "/catalogs/{catalog_id}" }));
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Get a catalog by ID
|
|
606
|
+
* Retrieves the specified catalog.
|
|
607
|
+
*/
|
|
608
|
+
export var getCatalogById = function (options) {
|
|
609
|
+
var _a;
|
|
610
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
611
|
+
{
|
|
612
|
+
scheme: "bearer",
|
|
613
|
+
type: "http",
|
|
614
|
+
},
|
|
615
|
+
], url: "/catalogs/{catalog_id}" }));
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* Updates a catalog
|
|
619
|
+
* Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated.
|
|
620
|
+
*/
|
|
621
|
+
export var updateCatalog = function (options) {
|
|
622
|
+
var _a;
|
|
623
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
624
|
+
{
|
|
625
|
+
scheme: "bearer",
|
|
626
|
+
type: "http",
|
|
627
|
+
},
|
|
628
|
+
], url: "/catalogs/{catalog_id}" }));
|
|
629
|
+
};
|
|
630
|
+
/**
|
|
631
|
+
* Deletes all releases
|
|
632
|
+
* Deletes all releases of the specified published catalog.
|
|
633
|
+
*/
|
|
634
|
+
export var deleteReleases = function (options) {
|
|
635
|
+
var _a;
|
|
636
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
637
|
+
{
|
|
638
|
+
scheme: "bearer",
|
|
639
|
+
type: "http",
|
|
640
|
+
},
|
|
641
|
+
], url: "/catalogs/{catalog_id}/releases" }));
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Gets all authorized catalog releases
|
|
645
|
+
* Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint.
|
|
646
|
+
*
|
|
647
|
+
* You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file.
|
|
648
|
+
*
|
|
649
|
+
* If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published.
|
|
650
|
+
*
|
|
651
|
+
*/
|
|
652
|
+
export var getReleases = function (options) {
|
|
653
|
+
var _a;
|
|
654
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
655
|
+
{
|
|
656
|
+
scheme: "bearer",
|
|
657
|
+
type: "http",
|
|
658
|
+
},
|
|
659
|
+
], url: "/catalogs/{catalog_id}/releases" }));
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Publishes a catalog
|
|
663
|
+
* Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog.
|
|
664
|
+
*
|
|
665
|
+
* You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
666
|
+
*
|
|
667
|
+
* You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date.
|
|
668
|
+
*
|
|
669
|
+
* Once a catalog release has completed publishing, the delta relationship links to the delta document.
|
|
670
|
+
*
|
|
671
|
+
* The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link.
|
|
672
|
+
*
|
|
673
|
+
* You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`.
|
|
674
|
+
*
|
|
675
|
+
* If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish.
|
|
676
|
+
*
|
|
677
|
+
* :::caution
|
|
678
|
+
*
|
|
679
|
+
* Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia.
|
|
680
|
+
*
|
|
681
|
+
* :::
|
|
682
|
+
*
|
|
683
|
+
* The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have.
|
|
684
|
+
*
|
|
685
|
+
* - Delta files are only available for 30 days.
|
|
686
|
+
* - Delta files are removed when a catalog release is deleted.
|
|
687
|
+
*
|
|
688
|
+
* Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release.
|
|
689
|
+
*
|
|
690
|
+
* - `delete` describes products deleted from this release of a catalog.
|
|
691
|
+
* - `createupdate` describes products updated in this release of a catalog.
|
|
692
|
+
*
|
|
693
|
+
* ### Multi-Store Management Solutions
|
|
694
|
+
*
|
|
695
|
+
* In a multi-store management solution.
|
|
696
|
+
*
|
|
697
|
+
* - You can create organization catalogs. Your organization catalogs are available for your stores to use.
|
|
698
|
+
* - Your stores can create their own catalogs.
|
|
699
|
+
* - Your stores can create catalogs that have a combination of organization products and store products.
|
|
700
|
+
*
|
|
701
|
+
* If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox.
|
|
702
|
+
*
|
|
703
|
+
* 1. Go to **SYSTEM** > **Store Settings**.
|
|
704
|
+
* 2. Click **General Settings**.
|
|
705
|
+
* 3. Select **PXM** from the list.
|
|
706
|
+
* 4. Select the **Include Organization Resources in Catalog Publishes** checkbox.
|
|
707
|
+
*
|
|
708
|
+
*/
|
|
709
|
+
export var publishRelease = function (options) {
|
|
710
|
+
var _a;
|
|
711
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
712
|
+
{
|
|
713
|
+
scheme: "bearer",
|
|
714
|
+
type: "http",
|
|
715
|
+
},
|
|
716
|
+
], url: "/catalogs/{catalog_id}/releases" }));
|
|
717
|
+
};
|
|
718
|
+
/**
|
|
719
|
+
* Deletes a release
|
|
720
|
+
* Deletes the specified published catalog release.
|
|
721
|
+
*/
|
|
722
|
+
export var deleteReleaseById = function (options) {
|
|
723
|
+
var _a;
|
|
724
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
725
|
+
{
|
|
726
|
+
scheme: "bearer",
|
|
727
|
+
type: "http",
|
|
728
|
+
},
|
|
729
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}" }));
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* Get a catalog release by ID
|
|
733
|
+
* Retrieves the specified catalog release.
|
|
734
|
+
*/
|
|
735
|
+
export var getReleaseById = function (options) {
|
|
736
|
+
var _a;
|
|
737
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
738
|
+
{
|
|
739
|
+
scheme: "bearer",
|
|
740
|
+
type: "http",
|
|
741
|
+
},
|
|
742
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}" }));
|
|
743
|
+
};
|
|
744
|
+
/**
|
|
745
|
+
* Gets all authorized catalog rules
|
|
746
|
+
* Retrieves all authorized catalog rules.
|
|
747
|
+
*
|
|
748
|
+
* ### Filtering
|
|
749
|
+
*
|
|
750
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are supported.
|
|
751
|
+
*
|
|
752
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
753
|
+
* |:--- |:--- |:--- |:--- |
|
|
754
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
755
|
+
*
|
|
756
|
+
*/
|
|
757
|
+
export var getRules = function (options) {
|
|
758
|
+
var _a;
|
|
759
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
760
|
+
{
|
|
761
|
+
scheme: "bearer",
|
|
762
|
+
type: "http",
|
|
763
|
+
},
|
|
764
|
+
], url: "/catalogs/rules" }));
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Creates a new catalog rule
|
|
768
|
+
* If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags.
|
|
769
|
+
*
|
|
770
|
+
* :::note
|
|
771
|
+
*
|
|
772
|
+
* - If you have one catalog for all customers and channels, you can omit creating this resource.
|
|
773
|
+
* - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed.
|
|
774
|
+
* - You cannot create catalog rules for organization catalogs.
|
|
775
|
+
*
|
|
776
|
+
* :::
|
|
777
|
+
*
|
|
778
|
+
* For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
779
|
+
*
|
|
780
|
+
*/
|
|
781
|
+
export var createRule = function (options) {
|
|
782
|
+
var _a;
|
|
783
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
784
|
+
{
|
|
785
|
+
scheme: "bearer",
|
|
786
|
+
type: "http",
|
|
787
|
+
},
|
|
788
|
+
], url: "/catalogs/rules" }));
|
|
789
|
+
};
|
|
790
|
+
/**
|
|
791
|
+
* Deletes a catalog rule
|
|
792
|
+
*/
|
|
793
|
+
export var deleteRuleById = function (options) {
|
|
794
|
+
var _a;
|
|
795
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
796
|
+
{
|
|
797
|
+
scheme: "bearer",
|
|
798
|
+
type: "http",
|
|
799
|
+
},
|
|
800
|
+
], url: "/catalogs/rules/{catalog_rule_id}" }));
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Get a catalog rule by ID
|
|
804
|
+
*/
|
|
805
|
+
export var getRuleById = function (options) {
|
|
806
|
+
var _a;
|
|
807
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
808
|
+
{
|
|
809
|
+
scheme: "bearer",
|
|
810
|
+
type: "http",
|
|
811
|
+
},
|
|
812
|
+
], url: "/catalogs/rules/{catalog_rule_id}" }));
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Updates a catalog rule
|
|
816
|
+
* Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated.
|
|
817
|
+
*/
|
|
818
|
+
export var updateRule = function (options) {
|
|
819
|
+
var _a;
|
|
820
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
821
|
+
{
|
|
822
|
+
scheme: "bearer",
|
|
823
|
+
type: "http",
|
|
824
|
+
},
|
|
825
|
+
], url: "/catalogs/rules/{catalog_rule_id}" }));
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* Get all Hierarchies
|
|
829
|
+
* Returns the hierarchies from a published catalog.
|
|
830
|
+
*
|
|
831
|
+
* :::note
|
|
832
|
+
*
|
|
833
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
834
|
+
*
|
|
835
|
+
* :::
|
|
836
|
+
*
|
|
837
|
+
* ### Filtering
|
|
838
|
+
*
|
|
839
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering).
|
|
840
|
+
*
|
|
841
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
842
|
+
* |:--- |:--- |:--- |:--- |
|
|
843
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
844
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
845
|
+
*
|
|
846
|
+
* ### Building breadcrumbs in a storefront
|
|
847
|
+
*
|
|
848
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
849
|
+
*
|
|
850
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
851
|
+
*
|
|
852
|
+
* - Specify the node Ids in the filter expression.
|
|
853
|
+
* - You can have as many node Ids as you want.
|
|
854
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
855
|
+
*
|
|
856
|
+
*/
|
|
857
|
+
export var getAllHierarchies = function (options) {
|
|
858
|
+
var _a;
|
|
859
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
860
|
+
{
|
|
861
|
+
scheme: "bearer",
|
|
862
|
+
type: "http",
|
|
863
|
+
},
|
|
864
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies" }));
|
|
865
|
+
};
|
|
866
|
+
/**
|
|
867
|
+
* Get a Hierarchy
|
|
868
|
+
* Returns the specified hierarchy from a published catalog.
|
|
869
|
+
*
|
|
870
|
+
* :::note
|
|
871
|
+
*
|
|
872
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
873
|
+
*
|
|
874
|
+
* :::
|
|
875
|
+
*
|
|
876
|
+
*/
|
|
877
|
+
export var getHierarchy = function (options) {
|
|
878
|
+
var _a;
|
|
879
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
880
|
+
{
|
|
881
|
+
scheme: "bearer",
|
|
882
|
+
type: "http",
|
|
883
|
+
},
|
|
884
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}" }));
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* Get a Hierarchy's Nodes
|
|
888
|
+
* Returns all nodes for the specified hierarchy from a published catalog.
|
|
889
|
+
*
|
|
890
|
+
* :::note
|
|
891
|
+
*
|
|
892
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
893
|
+
*
|
|
894
|
+
* :::
|
|
895
|
+
*
|
|
896
|
+
* In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
897
|
+
*
|
|
898
|
+
* ### Filtering
|
|
899
|
+
*
|
|
900
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering).
|
|
901
|
+
*
|
|
902
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
903
|
+
* |:--- |:--- |:--- |:--- |
|
|
904
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
905
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
906
|
+
*
|
|
907
|
+
* ### Building breadcrumbs in a storefront
|
|
908
|
+
*
|
|
909
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
910
|
+
*
|
|
911
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
912
|
+
*
|
|
913
|
+
* - Specify the node Ids in the filter expression.
|
|
914
|
+
* - You can have as many node Ids as you want.
|
|
915
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
916
|
+
*
|
|
917
|
+
*/
|
|
918
|
+
export var getHierarchyNodes = function (options) {
|
|
919
|
+
var _a;
|
|
920
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
921
|
+
{
|
|
922
|
+
scheme: "bearer",
|
|
923
|
+
type: "http",
|
|
924
|
+
},
|
|
925
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes" }));
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Get a Hierarchy's Children
|
|
929
|
+
* Returns the parent nodes for the specified hierarchy from a published catalog.
|
|
930
|
+
*
|
|
931
|
+
* 
|
|
932
|
+
*
|
|
933
|
+
* :::note
|
|
934
|
+
*
|
|
935
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
936
|
+
*
|
|
937
|
+
* :::
|
|
938
|
+
*
|
|
939
|
+
* In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
940
|
+
*
|
|
941
|
+
* ### Filtering
|
|
942
|
+
*
|
|
943
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering).
|
|
944
|
+
*
|
|
945
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
946
|
+
* |:--- |:--- |:--- |:--- |
|
|
947
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` |
|
|
948
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` |
|
|
949
|
+
*
|
|
950
|
+
* ### Building breadcrumbs in a storefront
|
|
951
|
+
*
|
|
952
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
953
|
+
*
|
|
954
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
955
|
+
*
|
|
956
|
+
* - Specify the node Ids in the filter expression.
|
|
957
|
+
* - You can have as many node Ids as you want.
|
|
958
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
959
|
+
*
|
|
960
|
+
*/
|
|
961
|
+
export var getHierarchyChildNodes = function (options) {
|
|
962
|
+
var _a;
|
|
963
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
964
|
+
{
|
|
965
|
+
scheme: "bearer",
|
|
966
|
+
type: "http",
|
|
967
|
+
},
|
|
968
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children" }));
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Get all Nodes
|
|
972
|
+
* Returns the child nodes from a published catalog.
|
|
973
|
+
*
|
|
974
|
+
* :::note
|
|
975
|
+
*
|
|
976
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
977
|
+
*
|
|
978
|
+
* :::
|
|
979
|
+
*
|
|
980
|
+
* You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
981
|
+
*
|
|
982
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront).
|
|
983
|
+
*
|
|
984
|
+
* The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront.
|
|
985
|
+
*
|
|
986
|
+
* - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first.
|
|
987
|
+
* - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time.
|
|
988
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
989
|
+
* - If a curated product is removed from a node, the product is also removed from the `curated_products` list.
|
|
990
|
+
* - A product that is curated has the `"curated_product": true` attribute displayed.
|
|
991
|
+
*
|
|
992
|
+
* ### Filtering
|
|
993
|
+
*
|
|
994
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available.
|
|
995
|
+
*
|
|
996
|
+
* | Operator | Description | Attributes | Example |
|
|
997
|
+
* | --- | --- | --- | --- |
|
|
998
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` |
|
|
999
|
+
* | `in` | Checks if the values are included in the specified string. If they are, the condition is true.
|
|
1000
|
+
* | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` |
|
|
1001
|
+
*
|
|
1002
|
+
* ### Building breadcrumbs in a storefront
|
|
1003
|
+
*
|
|
1004
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1005
|
+
*
|
|
1006
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1007
|
+
*
|
|
1008
|
+
* - Specify the node Ids in the filter expression.
|
|
1009
|
+
* - You can have as many node Ids as you want.
|
|
1010
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1011
|
+
*
|
|
1012
|
+
*/
|
|
1013
|
+
export var getAllNodes = function (options) {
|
|
1014
|
+
var _a;
|
|
1015
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1016
|
+
{
|
|
1017
|
+
scheme: "bearer",
|
|
1018
|
+
type: "http",
|
|
1019
|
+
},
|
|
1020
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes" }));
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Get a Node
|
|
1024
|
+
* Returns a node from a published catalog.
|
|
1025
|
+
*
|
|
1026
|
+
* :::note
|
|
1027
|
+
*
|
|
1028
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
1029
|
+
*
|
|
1030
|
+
* :::
|
|
1031
|
+
*
|
|
1032
|
+
* You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1033
|
+
*
|
|
1034
|
+
* The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront.
|
|
1035
|
+
*
|
|
1036
|
+
* - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first.
|
|
1037
|
+
* - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time.
|
|
1038
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
1039
|
+
* - If a curated product is removed from a node, the product is also removed from the `curated_products` list.
|
|
1040
|
+
* - A product that is curated has the `"curated_product": true` attribute displayed.
|
|
1041
|
+
*
|
|
1042
|
+
*/
|
|
1043
|
+
export var getNode = function (options) {
|
|
1044
|
+
var _a;
|
|
1045
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1046
|
+
{
|
|
1047
|
+
scheme: "bearer",
|
|
1048
|
+
type: "http",
|
|
1049
|
+
},
|
|
1050
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}" }));
|
|
1051
|
+
};
|
|
1052
|
+
/**
|
|
1053
|
+
* Get a Node's Children
|
|
1054
|
+
* Returns the child nodes for a node from a published catalog.
|
|
1055
|
+
*
|
|
1056
|
+
* :::note
|
|
1057
|
+
*
|
|
1058
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
1059
|
+
*
|
|
1060
|
+
* :::
|
|
1061
|
+
*
|
|
1062
|
+
* You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1063
|
+
*
|
|
1064
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront).
|
|
1065
|
+
*
|
|
1066
|
+
* The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront.
|
|
1067
|
+
*
|
|
1068
|
+
* - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first.
|
|
1069
|
+
* - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time.
|
|
1070
|
+
* - You can only curate 20 products or less. You cannot have more than 20 curated products.
|
|
1071
|
+
* - If a curated product is removed from a node, the product is also removed from the `curated_products` list.
|
|
1072
|
+
* - A product that is curated has the `"curated_product": true` attribute displayed.
|
|
1073
|
+
*
|
|
1074
|
+
* ### Filtering
|
|
1075
|
+
*
|
|
1076
|
+
* This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available.
|
|
1077
|
+
*
|
|
1078
|
+
* | Operator | Description | Attributes | Example |
|
|
1079
|
+
* | --- | --- | --- | --- |
|
|
1080
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` |
|
|
1081
|
+
* | `in` | Checks if the values are included in the specified string. If they are, the condition is true.
|
|
1082
|
+
* | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` |
|
|
1083
|
+
*
|
|
1084
|
+
* ### Building breadcrumbs in a storefront
|
|
1085
|
+
*
|
|
1086
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1087
|
+
*
|
|
1088
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1089
|
+
*
|
|
1090
|
+
* - Specify the node Ids in the filter expression.
|
|
1091
|
+
* - You can have as many node Ids as you want.
|
|
1092
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1093
|
+
*
|
|
1094
|
+
*/
|
|
1095
|
+
export var getChildNodes = function (options) {
|
|
1096
|
+
var _a;
|
|
1097
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1098
|
+
{
|
|
1099
|
+
scheme: "bearer",
|
|
1100
|
+
type: "http",
|
|
1101
|
+
},
|
|
1102
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children" }));
|
|
1103
|
+
};
|
|
1104
|
+
/**
|
|
1105
|
+
* Get all Products
|
|
1106
|
+
* Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
1107
|
+
*
|
|
1108
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1109
|
+
*
|
|
1110
|
+
* The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values.
|
|
1111
|
+
*
|
|
1112
|
+
* ### Including Resources
|
|
1113
|
+
*
|
|
1114
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1115
|
+
*
|
|
1116
|
+
* | Parameter | Required | Description |
|
|
1117
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1118
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1119
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1120
|
+
* | `files` | Optional | Any files associated with a product.
|
|
1121
|
+
*
|
|
1122
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1123
|
+
*
|
|
1124
|
+
* ### Filtering
|
|
1125
|
+
*
|
|
1126
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
1127
|
+
*
|
|
1128
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
1129
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
1130
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
1131
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
1132
|
+
*
|
|
1133
|
+
* ### Building breadcrumbs in a storefront
|
|
1134
|
+
*
|
|
1135
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1136
|
+
*
|
|
1137
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1138
|
+
*
|
|
1139
|
+
* - Specify the node Ids in the filter expression.
|
|
1140
|
+
* - You can have as many node Ids as you want.
|
|
1141
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1142
|
+
*
|
|
1143
|
+
*/
|
|
1144
|
+
export var getAllProducts = function (options) {
|
|
1145
|
+
var _a;
|
|
1146
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1147
|
+
{
|
|
1148
|
+
scheme: "bearer",
|
|
1149
|
+
type: "http",
|
|
1150
|
+
},
|
|
1151
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/products" }));
|
|
1152
|
+
};
|
|
1153
|
+
/**
|
|
1154
|
+
* Get a Product
|
|
1155
|
+
* Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
1156
|
+
*
|
|
1157
|
+
* ### Product and Node Associations in Breadcrumb Metadata
|
|
1158
|
+
*
|
|
1159
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1160
|
+
*
|
|
1161
|
+
* ### Product Variations
|
|
1162
|
+
*
|
|
1163
|
+
* The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values.
|
|
1164
|
+
*
|
|
1165
|
+
* ### Including Resources
|
|
1166
|
+
*
|
|
1167
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1168
|
+
*
|
|
1169
|
+
* | Parameter | Required | Description |
|
|
1170
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1171
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1172
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1173
|
+
* | `files` | Optional | Any files associated with a product.
|
|
1174
|
+
*
|
|
1175
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1176
|
+
*
|
|
1177
|
+
*/
|
|
1178
|
+
export var getProduct = function (options) {
|
|
1179
|
+
var _a;
|
|
1180
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1181
|
+
{
|
|
1182
|
+
scheme: "bearer",
|
|
1183
|
+
type: "http",
|
|
1184
|
+
},
|
|
1185
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}" }));
|
|
1186
|
+
};
|
|
1187
|
+
/**
|
|
1188
|
+
* Get a Bundle's Component Products
|
|
1189
|
+
* With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together.
|
|
1190
|
+
*
|
|
1191
|
+
* You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.
|
|
1192
|
+
*
|
|
1193
|
+
* This endpoint returns a list of component product IDs for the specified bundle.
|
|
1194
|
+
*
|
|
1195
|
+
* ### Including Resources
|
|
1196
|
+
*
|
|
1197
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1198
|
+
*
|
|
1199
|
+
* | Parameter | Required | Description |
|
|
1200
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1201
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1202
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1203
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
1204
|
+
*
|
|
1205
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1206
|
+
*
|
|
1207
|
+
*/
|
|
1208
|
+
export var getComponentProductIds = function (options) {
|
|
1209
|
+
var _a;
|
|
1210
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1211
|
+
{
|
|
1212
|
+
scheme: "bearer",
|
|
1213
|
+
type: "http",
|
|
1214
|
+
},
|
|
1215
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products" }));
|
|
1216
|
+
};
|
|
1217
|
+
/**
|
|
1218
|
+
* Get a Parent Product's Child Products
|
|
1219
|
+
* For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved.
|
|
1220
|
+
*
|
|
1221
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
1222
|
+
*
|
|
1223
|
+
* You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1224
|
+
*
|
|
1225
|
+
* ### Filtering
|
|
1226
|
+
*
|
|
1227
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
1228
|
+
*
|
|
1229
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
1230
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
1231
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
1232
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
1233
|
+
*
|
|
1234
|
+
* ### Building breadcrumbs in a storefront
|
|
1235
|
+
*
|
|
1236
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1237
|
+
*
|
|
1238
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1239
|
+
*
|
|
1240
|
+
* - Specify the node Ids in the filter expression.
|
|
1241
|
+
* - You can have as many node Ids as you want.
|
|
1242
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1243
|
+
*
|
|
1244
|
+
* ### Including Resources
|
|
1245
|
+
*
|
|
1246
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1247
|
+
*
|
|
1248
|
+
* | Parameter | Required | Description |
|
|
1249
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1250
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1251
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1252
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
1253
|
+
*
|
|
1254
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1255
|
+
*
|
|
1256
|
+
*/
|
|
1257
|
+
export var getChildProducts = function (options) {
|
|
1258
|
+
var _a;
|
|
1259
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1260
|
+
{
|
|
1261
|
+
scheme: "bearer",
|
|
1262
|
+
type: "http",
|
|
1263
|
+
},
|
|
1264
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children" }));
|
|
1265
|
+
};
|
|
1266
|
+
/**
|
|
1267
|
+
* Get a Hierarchy's Products
|
|
1268
|
+
* Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status.
|
|
1269
|
+
*
|
|
1270
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
1271
|
+
*
|
|
1272
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1273
|
+
*
|
|
1274
|
+
* The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values.
|
|
1275
|
+
*
|
|
1276
|
+
* ### Filtering
|
|
1277
|
+
*
|
|
1278
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
1279
|
+
*
|
|
1280
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
1281
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
1282
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
1283
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
1284
|
+
*
|
|
1285
|
+
* ### Building breadcrumbs in a storefront
|
|
1286
|
+
*
|
|
1287
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1288
|
+
*
|
|
1289
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1290
|
+
*
|
|
1291
|
+
* - Specify the node Ids in the filter expression.
|
|
1292
|
+
* - You can have as many node Ids as you want.
|
|
1293
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1294
|
+
*
|
|
1295
|
+
* ### Including Resources
|
|
1296
|
+
*
|
|
1297
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1298
|
+
*
|
|
1299
|
+
* | Parameter | Required | Description |
|
|
1300
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1301
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1302
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1303
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
1304
|
+
*
|
|
1305
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1306
|
+
*
|
|
1307
|
+
*/
|
|
1308
|
+
export var getProductsForHierarchy = function (options) {
|
|
1309
|
+
var _a;
|
|
1310
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1311
|
+
{
|
|
1312
|
+
scheme: "bearer",
|
|
1313
|
+
type: "http",
|
|
1314
|
+
},
|
|
1315
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products" }));
|
|
1316
|
+
};
|
|
1317
|
+
/**
|
|
1318
|
+
* Get a Node's Products
|
|
1319
|
+
* Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed.
|
|
1320
|
+
*
|
|
1321
|
+
* :::note
|
|
1322
|
+
*
|
|
1323
|
+
* Currently, published catalogs are limited to the current release and two releases prior to the current release.
|
|
1324
|
+
*
|
|
1325
|
+
* :::
|
|
1326
|
+
*
|
|
1327
|
+
* If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules).
|
|
1328
|
+
*
|
|
1329
|
+
* You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs).
|
|
1330
|
+
*
|
|
1331
|
+
* The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values.
|
|
1332
|
+
*
|
|
1333
|
+
* ### Filtering
|
|
1334
|
+
*
|
|
1335
|
+
* This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint.
|
|
1336
|
+
*
|
|
1337
|
+
* | Operator | Description | Supported Attributes | Example |
|
|
1338
|
+
* |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- |
|
|
1339
|
+
* | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` |
|
|
1340
|
+
* | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` |
|
|
1341
|
+
*
|
|
1342
|
+
* ### Building breadcrumbs in a storefront
|
|
1343
|
+
*
|
|
1344
|
+
* In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
|
|
1345
|
+
*
|
|
1346
|
+
* `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)`
|
|
1347
|
+
*
|
|
1348
|
+
* - Specify the node Ids in the filter expression.
|
|
1349
|
+
* - You can have as many node Ids as you want.
|
|
1350
|
+
* - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
|
|
1351
|
+
*
|
|
1352
|
+
* ### Including Resources
|
|
1353
|
+
*
|
|
1354
|
+
* Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
|
|
1355
|
+
*
|
|
1356
|
+
* | Parameter | Required | Description |
|
|
1357
|
+
* | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1358
|
+
* | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
|
|
1359
|
+
* | `main_image` | Optional | The main images associated with a product. |
|
|
1360
|
+
* | `files` | Optional | Any files associated with a product. |
|
|
1361
|
+
*
|
|
1362
|
+
* See [**Including Resources**](/guides/Getting-Started/includes).
|
|
1363
|
+
*
|
|
1364
|
+
*/
|
|
1365
|
+
export var getProductsForNode = function (options) {
|
|
1366
|
+
var _a;
|
|
1367
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1368
|
+
{
|
|
1369
|
+
scheme: "bearer",
|
|
1370
|
+
type: "http",
|
|
1371
|
+
},
|
|
1372
|
+
], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products" }));
|
|
1373
|
+
};
|
|
1374
|
+
/**
|
|
1375
|
+
* Get Shopper Carts
|
|
1376
|
+
* You can retrieve the carts that are associated with an [account](/docs/api/carts/account-cart-associations) or a [customer](/docs/api/carts/customer-cart-associations).
|
|
1377
|
+
*
|
|
1378
|
+
* When a shopper retrieves their latest carts, the carts are sorted in descending order by the updated_date. For more information, see [Pagination](/guides/Getting-Started/pagination).
|
|
1379
|
+
*
|
|
1380
|
+
* :::note
|
|
1381
|
+
*
|
|
1382
|
+
* Requires an `implicit` token with only one of [Account Management Authentication Token](/docs/api/accounts/post-v-2-account-members-tokens) or [customer token](/docs/customer-management/customer-management-api/customer-tokens).
|
|
1383
|
+
*
|
|
1384
|
+
* :::
|
|
1385
|
+
*
|
|
1386
|
+
*/
|
|
1387
|
+
export var getCarts = function (options) {
|
|
1388
|
+
var _a;
|
|
1389
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1390
|
+
{
|
|
1391
|
+
scheme: "bearer",
|
|
1392
|
+
type: "http",
|
|
1393
|
+
},
|
|
1394
|
+
], url: "/v2/carts" }));
|
|
1395
|
+
};
|
|
1396
|
+
/**
|
|
1397
|
+
* Create a Cart
|
|
1398
|
+
*
|
|
1399
|
+
* Creates a cart. Call this endpoint each time a customer creates a cart.
|
|
1400
|
+
*
|
|
1401
|
+
* Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts.
|
|
1402
|
+
*
|
|
1403
|
+
* After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used.
|
|
1404
|
+
*
|
|
1405
|
+
* You can also create a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Update Cart Settings](/docs/api/settings/put-v-2-settings-cart).
|
|
1406
|
+
*
|
|
1407
|
+
* ### Preview Cart
|
|
1408
|
+
*
|
|
1409
|
+
* You can set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart.
|
|
1410
|
+
*
|
|
1411
|
+
* :::caution
|
|
1412
|
+
* - Once the cart is in preview mode, you cannot revert it to a regular cart.
|
|
1413
|
+
* - Carts with `snapshot_date` are same as preview carts.
|
|
1414
|
+
* - You cannot checkout a cart that includes a `snapshot_date`.
|
|
1415
|
+
* - To delete a promotion preview cart, use [Delete a cart](/docs/api/carts/delete-a-cart) endpoint.
|
|
1416
|
+
* - The promotion preview cart has the same expiration time as a regular cart based on the store's [cart settings](/docs/api/settings/put-v-2-settings-cart).
|
|
1417
|
+
* - Preview cart interactions skip inventory checks and events, allowing users to preview future carts without impacting related external systems.
|
|
1418
|
+
* :::
|
|
1419
|
+
*
|
|
1420
|
+
* ### Errors
|
|
1421
|
+
*
|
|
1422
|
+
* - `400 Bad Request` : This is returned when the submitted request does not adhere to the expected API contract for the endpoint.
|
|
1423
|
+
*
|
|
1424
|
+
* - For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section.
|
|
1425
|
+
* - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`.
|
|
1426
|
+
*
|
|
1427
|
+
*/
|
|
1428
|
+
export var createACart = function (options) {
|
|
1429
|
+
var _a;
|
|
1430
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
1431
|
+
{
|
|
1432
|
+
scheme: "bearer",
|
|
1433
|
+
type: "http",
|
|
1434
|
+
},
|
|
1435
|
+
], url: "/v2/carts" }));
|
|
1436
|
+
};
|
|
1437
|
+
/**
|
|
1438
|
+
* Delete a Cart
|
|
1439
|
+
* You can delete a cart, including the items, name, description, and remove all associations.
|
|
1440
|
+
*
|
|
1441
|
+
* ### Errors
|
|
1442
|
+
*
|
|
1443
|
+
* The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated.
|
|
1444
|
+
*
|
|
1445
|
+
* ```json
|
|
1446
|
+
* message: {
|
|
1447
|
+
* errors: [
|
|
1448
|
+
* {
|
|
1449
|
+
* status: 400,
|
|
1450
|
+
* title: 'Last cart',
|
|
1451
|
+
* detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead'
|
|
1452
|
+
* }
|
|
1453
|
+
* ]
|
|
1454
|
+
* }
|
|
1455
|
+
* ````
|
|
1456
|
+
*
|
|
1457
|
+
*/
|
|
1458
|
+
export var deleteACart = function (options) {
|
|
1459
|
+
var _a;
|
|
1460
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
1461
|
+
{
|
|
1462
|
+
scheme: "bearer",
|
|
1463
|
+
type: "http",
|
|
1464
|
+
},
|
|
1465
|
+
], url: "/v2/carts/{cartID}" }));
|
|
1466
|
+
};
|
|
1467
|
+
/**
|
|
1468
|
+
* Get a Cart
|
|
1469
|
+
* Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the `relationships` section.
|
|
1470
|
+
*
|
|
1471
|
+
* You can easily get a new or existing cart by providing the unique cart reference in the request. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships section.
|
|
1472
|
+
*
|
|
1473
|
+
* :::note
|
|
1474
|
+
*
|
|
1475
|
+
* - The default cart name is Cart. However, you can update the cart name as required. Ensure that the string length of the name is greater than or equal to one. Follow the safe character guidelines for name and description naming. For more information about cart ID naming requirements, see the [Safe Characters](/guides/Getting-Started/safe-characters) section.
|
|
1476
|
+
* - Outside of the JS-SDK, we don’t handle creating cart references. You need to create your own.
|
|
1477
|
+
*
|
|
1478
|
+
* :::
|
|
1479
|
+
*
|
|
1480
|
+
* :::caution
|
|
1481
|
+
*
|
|
1482
|
+
* An empty cart is returned for any carts that don’t currently exist. For more information about the cart items object, see [Get Cart Items](/docs/api/carts/get-cart-items).
|
|
1483
|
+
*
|
|
1484
|
+
* :::
|
|
1485
|
+
*
|
|
1486
|
+
* ### Query parameters
|
|
1487
|
+
*
|
|
1488
|
+
*
|
|
1489
|
+
* | Name | Required | Type | Description |
|
|
1490
|
+
* |:----------|:---------|:---------|:-------------------------------------------|
|
|
1491
|
+
* | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. |
|
|
1492
|
+
*
|
|
1493
|
+
*/
|
|
1494
|
+
export var getCart = function (options) {
|
|
1495
|
+
var _a;
|
|
1496
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1497
|
+
{
|
|
1498
|
+
scheme: "bearer",
|
|
1499
|
+
type: "http",
|
|
1500
|
+
},
|
|
1501
|
+
], url: "/v2/carts/{cartID}" }));
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Update a Cart
|
|
1505
|
+
* Updates cart properties for the specified cartID.
|
|
1506
|
+
*
|
|
1507
|
+
* You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart).
|
|
1508
|
+
*
|
|
1509
|
+
*/
|
|
1510
|
+
export var updateACart = function (options) {
|
|
1511
|
+
var _a;
|
|
1512
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
1513
|
+
{
|
|
1514
|
+
scheme: "bearer",
|
|
1515
|
+
type: "http",
|
|
1516
|
+
},
|
|
1517
|
+
], url: "/v2/carts/{cartID}" }));
|
|
1518
|
+
};
|
|
1519
|
+
/**
|
|
1520
|
+
* Delete all Cart Items
|
|
1521
|
+
* A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart.
|
|
1522
|
+
*
|
|
1523
|
+
*/
|
|
1524
|
+
export var deleteAllCartItems = function (options) {
|
|
1525
|
+
var _a;
|
|
1526
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
1527
|
+
{
|
|
1528
|
+
scheme: "bearer",
|
|
1529
|
+
type: "http",
|
|
1530
|
+
},
|
|
1531
|
+
], url: "/v2/carts/{cartID}/items" }));
|
|
1532
|
+
};
|
|
1533
|
+
/**
|
|
1534
|
+
* Get Cart Items
|
|
1535
|
+
*
|
|
1536
|
+
* Use this endpoint to retrieve cart items. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs.
|
|
1537
|
+
*
|
|
1538
|
+
* You can use this endpoint to retrieve the breakdown of cart items by promotion ID. For example, if you have Promotions Standard item discount with code *sale2024*, Rule Promotions item discount with code *sale2024*, and Rule Promotions cart discount with code *sale2024*, the `discounts.constituents` field in the response example will show the breakdown of the same promotion code used in both Promotions Standard and Rule Promotions.
|
|
1539
|
+
*
|
|
1540
|
+
* ```json
|
|
1541
|
+
* "data": [
|
|
1542
|
+
* {
|
|
1543
|
+
* "id": "98de010d-dd10-4fa5-a070-0b9bcdc72974",
|
|
1544
|
+
* "type": "cart_item",
|
|
1545
|
+
* "product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c",
|
|
1546
|
+
* "name": "sku1",
|
|
1547
|
+
* "description": "sku1",
|
|
1548
|
+
* "sku": "sku1",
|
|
1549
|
+
* "slug": "sku1",
|
|
1550
|
+
* "image": {
|
|
1551
|
+
* "mime_type": "",
|
|
1552
|
+
* "file_name": "",
|
|
1553
|
+
* "href": ""
|
|
1554
|
+
* },
|
|
1555
|
+
* "quantity": 1,
|
|
1556
|
+
* "manage_stock": false,
|
|
1557
|
+
* "unit_price": {
|
|
1558
|
+
* "amount": 10000,
|
|
1559
|
+
* "currency": "USD",
|
|
1560
|
+
* "includes_tax": false
|
|
1561
|
+
* },
|
|
1562
|
+
* "value": {
|
|
1563
|
+
* "amount": 10000,
|
|
1564
|
+
* "currency": "USD",
|
|
1565
|
+
* "includes_tax": false
|
|
1566
|
+
* },
|
|
1567
|
+
* "discounts": [
|
|
1568
|
+
* {
|
|
1569
|
+
* "amount": {
|
|
1570
|
+
* "amount": -2000,
|
|
1571
|
+
* "currency": "USD",
|
|
1572
|
+
* "includes_tax": false
|
|
1573
|
+
* },
|
|
1574
|
+
* "code": "sale2024",
|
|
1575
|
+
* "id": "e4d929d5-f471-4317-9a86-a84a6c572b44",
|
|
1576
|
+
* "promotion_source": "rule-promotion",
|
|
1577
|
+
* "is_cart_discount": true
|
|
1578
|
+
* },
|
|
1579
|
+
* {
|
|
1580
|
+
* "amount": {
|
|
1581
|
+
* "amount": -1000,
|
|
1582
|
+
* "currency": "USD",
|
|
1583
|
+
* "includes_tax": false
|
|
1584
|
+
* },
|
|
1585
|
+
* "code": "sale2024",
|
|
1586
|
+
* "id": "de19a043-a6da-4bde-b896-d17e16b77e25",
|
|
1587
|
+
* "promotion_source": "rule-promotion"
|
|
1588
|
+
* },
|
|
1589
|
+
* {
|
|
1590
|
+
* "amount": {
|
|
1591
|
+
* "amount": -1000,
|
|
1592
|
+
* "currency": "USD",
|
|
1593
|
+
* "includes_tax": false
|
|
1594
|
+
* },
|
|
1595
|
+
* "code": "sale2024",
|
|
1596
|
+
* "id": "509295ee-2971-45b6-801e-95df09756989"
|
|
1597
|
+
* },
|
|
1598
|
+
* {
|
|
1599
|
+
* "amount": {
|
|
1600
|
+
* "amount": -1000,
|
|
1601
|
+
* "currency": "USD",
|
|
1602
|
+
* "includes_tax": false
|
|
1603
|
+
* },
|
|
1604
|
+
* "code": "sale2024",
|
|
1605
|
+
* "id": "ca79e606-7ecd-41ac-9478-af4c8c28c546",
|
|
1606
|
+
* "promotion_source": "rule-promotion",
|
|
1607
|
+
* "is_cart_discount": true
|
|
1608
|
+
* }
|
|
1609
|
+
* ],
|
|
1610
|
+
* "links": {
|
|
1611
|
+
* "product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c"
|
|
1612
|
+
* },
|
|
1613
|
+
* "meta": {
|
|
1614
|
+
* "display_price": {
|
|
1615
|
+
* "with_tax": {
|
|
1616
|
+
* "unit": {
|
|
1617
|
+
* "amount": 5000,
|
|
1618
|
+
* "currency": "USD",
|
|
1619
|
+
* "formatted": "$50.00"
|
|
1620
|
+
* },
|
|
1621
|
+
* "value": {
|
|
1622
|
+
* "amount": 5000,
|
|
1623
|
+
* "currency": "USD",
|
|
1624
|
+
* "formatted": "$50.00"
|
|
1625
|
+
* }
|
|
1626
|
+
* },
|
|
1627
|
+
* "without_tax": {
|
|
1628
|
+
* "unit": {
|
|
1629
|
+
* "amount": 5000,
|
|
1630
|
+
* "currency": "USD",
|
|
1631
|
+
* "formatted": "$50.00"
|
|
1632
|
+
* },
|
|
1633
|
+
* "value": {
|
|
1634
|
+
* "amount": 5000,
|
|
1635
|
+
* "currency": "USD",
|
|
1636
|
+
* "formatted": "$50.00"
|
|
1637
|
+
* }
|
|
1638
|
+
* },
|
|
1639
|
+
* "tax": {
|
|
1640
|
+
* "unit": {
|
|
1641
|
+
* "amount": 0,
|
|
1642
|
+
* "currency": "USD",
|
|
1643
|
+
* "formatted": "$0.00"
|
|
1644
|
+
* },
|
|
1645
|
+
* "value": {
|
|
1646
|
+
* "amount": 0,
|
|
1647
|
+
* "currency": "USD",
|
|
1648
|
+
* "formatted": "$0.00"
|
|
1649
|
+
* }
|
|
1650
|
+
* },
|
|
1651
|
+
* "discount": {
|
|
1652
|
+
* "unit": {
|
|
1653
|
+
* "amount": -5000,
|
|
1654
|
+
* "currency": "USD",
|
|
1655
|
+
* "formatted": "-$50.00"
|
|
1656
|
+
* },
|
|
1657
|
+
* "value": {
|
|
1658
|
+
* "amount": -5000,
|
|
1659
|
+
* "currency": "USD",
|
|
1660
|
+
* "formatted": "-$50.00"
|
|
1661
|
+
* }
|
|
1662
|
+
* },
|
|
1663
|
+
* "without_discount": {
|
|
1664
|
+
* "unit": {
|
|
1665
|
+
* "amount": 10000,
|
|
1666
|
+
* "currency": "USD",
|
|
1667
|
+
* "formatted": "$100.00"
|
|
1668
|
+
* },
|
|
1669
|
+
* "value": {
|
|
1670
|
+
* "amount": 10000,
|
|
1671
|
+
* "currency": "USD",
|
|
1672
|
+
* "formatted": "$100.00"
|
|
1673
|
+
* }
|
|
1674
|
+
* },
|
|
1675
|
+
* "discounts": {
|
|
1676
|
+
* "sale2024": {
|
|
1677
|
+
* "amount": -5000,
|
|
1678
|
+
* "currency": "USD",
|
|
1679
|
+
* "formatted": "-$50.00",
|
|
1680
|
+
* "constituents": {
|
|
1681
|
+
* "509295ee-2971-45b6-801e-95df09756989": {
|
|
1682
|
+
* "amount": -1000,
|
|
1683
|
+
* "currency": "USD",
|
|
1684
|
+
* "formatted": "-$10.00"
|
|
1685
|
+
* },
|
|
1686
|
+
* "ca79e606-7ecd-41ac-9478-af4c8c28c546": {
|
|
1687
|
+
* "amount": -1000,
|
|
1688
|
+
* "currency": "USD",
|
|
1689
|
+
* "formatted": "-$10.00"
|
|
1690
|
+
* },
|
|
1691
|
+
* "de19a043-a6da-4bde-b896-d17e16b77e25": {
|
|
1692
|
+
* "amount": -1000,
|
|
1693
|
+
* "currency": "USD",
|
|
1694
|
+
* "formatted": "-$10.00"
|
|
1695
|
+
* },
|
|
1696
|
+
* "e4d929d5-f471-4317-9a86-a84a6c572b44": {
|
|
1697
|
+
* "amount": -2000,
|
|
1698
|
+
* "currency": "USD",
|
|
1699
|
+
* "formatted": "-$20.00"
|
|
1700
|
+
* }
|
|
1701
|
+
* }
|
|
1702
|
+
* }
|
|
1703
|
+
* }
|
|
1704
|
+
* },
|
|
1705
|
+
* "timestamps": {
|
|
1706
|
+
* "created_at": "2024-05-24T18:00:58Z",
|
|
1707
|
+
* "updated_at": "2024-05-24T18:00:58Z"
|
|
1708
|
+
* }
|
|
1709
|
+
* },
|
|
1710
|
+
* "catalog_id": "09b9359f-897f-407f-89a2-702e167fe781",
|
|
1711
|
+
* "catalog_source": "pim"
|
|
1712
|
+
* }
|
|
1713
|
+
* ```
|
|
1714
|
+
*
|
|
1715
|
+
*/
|
|
1716
|
+
export var getCartItems = function (options) {
|
|
1717
|
+
var _a;
|
|
1718
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
1719
|
+
{
|
|
1720
|
+
scheme: "bearer",
|
|
1721
|
+
type: "http",
|
|
1722
|
+
},
|
|
1723
|
+
], url: "/v2/carts/{cartID}/items" }));
|
|
1724
|
+
};
|
|
1725
|
+
/**
|
|
1726
|
+
* Manage Carts
|
|
1727
|
+
*
|
|
1728
|
+
* ### Add Product to Cart
|
|
1729
|
+
*
|
|
1730
|
+
* Adding a Product to Cart is the most common Cart action. If you want to add any custom products or promotions, you need to do that as a separate action.
|
|
1731
|
+
*
|
|
1732
|
+
* #### Dynamic Bundles
|
|
1733
|
+
*
|
|
1734
|
+
* A bundle is a purchasable product that is composed of a combination of two or more products that you want to sell together. You can create multiple components within a bundle. Each component can have one or more options. Each option is a product and a quantity. You can configure minimum and/or maximum values for the number of product options in a component that your shoppers can select. For example, you can enable a shopper to select 1 or more product options from a list of 10. These are called [dynamic bundles](/docs/api/pxm/products/products#dynamic-bundles).
|
|
1735
|
+
*
|
|
1736
|
+
* Your dynamic bundles are displayed in your published catalogs.
|
|
1737
|
+
*
|
|
1738
|
+
* 1. Use the configure a shopper endpoint to allow shoppers to make their selections from a bundle.
|
|
1739
|
+
* 2. In the response of the configure a shopper, the `bundle_configuration` object contains the bundle selections a shopper has made.
|
|
1740
|
+
* 3. In the add a product to cart request, use the `bundle_configuration` object to add the customers selections to a cart.
|
|
1741
|
+
*
|
|
1742
|
+
* ```json
|
|
1743
|
+
* "bundle_configuration": {
|
|
1744
|
+
* "selected_options": {
|
|
1745
|
+
* "games": {
|
|
1746
|
+
* "d7b79eb8-19d8-45ea-86ed-2324a604dd9c": 1
|
|
1747
|
+
* },
|
|
1748
|
+
* "toys": {
|
|
1749
|
+
* "0192ccdd-6d33-4898-87d7-c4d87f2bf8ea": 1,
|
|
1750
|
+
* "1aea6f97-f0d9-452c-b3c1-7fb5629ead82": 1
|
|
1751
|
+
* }
|
|
1752
|
+
* }
|
|
1753
|
+
* }
|
|
1754
|
+
* ```
|
|
1755
|
+
*
|
|
1756
|
+
* When a cart is checked out, the options a shopper selected are added to the order. See [order items](/docs/api/carts/get-order-items).
|
|
1757
|
+
*
|
|
1758
|
+
* #### Personalized Products
|
|
1759
|
+
*
|
|
1760
|
+
* You can allow shoppers to personalize their goods by adding custom text inputs to products directly. This feature is particularly useful for customizable items, such as personalized T-shirts or greeting cards. You can use this functionality by leveraging the `custom_inputs` attribute, and defining the details and validation rules for the custom text.
|
|
1761
|
+
*
|
|
1762
|
+
* First, you must configure a `custom_inputs` attribute when creating a new product or updating an existing product. Once you have defined your custom inputs on a product, you must configure the custom inputs in your orders.
|
|
1763
|
+
*
|
|
1764
|
+
* For example, you may sell T-shirts that can have personalized text on the front and back of the shirt.
|
|
1765
|
+
*
|
|
1766
|
+
* ```json
|
|
1767
|
+
* {
|
|
1768
|
+
* "data": {
|
|
1769
|
+
* "type": "product",
|
|
1770
|
+
* "attributes": {
|
|
1771
|
+
* "custom_inputs": {
|
|
1772
|
+
* "front": {
|
|
1773
|
+
* "name": "T-Shirt Front",
|
|
1774
|
+
* "validation_rules": [
|
|
1775
|
+
* {
|
|
1776
|
+
* "type": "string",
|
|
1777
|
+
* "options": {
|
|
1778
|
+
* "max_length": 50
|
|
1779
|
+
* }
|
|
1780
|
+
* }
|
|
1781
|
+
* ],
|
|
1782
|
+
* "required": false
|
|
1783
|
+
* },
|
|
1784
|
+
* "back": {
|
|
1785
|
+
* "name": "T-Shirt Back",
|
|
1786
|
+
* "validation_rules": [
|
|
1787
|
+
* {
|
|
1788
|
+
* "type": "string",
|
|
1789
|
+
* "options": {
|
|
1790
|
+
* "max_length": 50
|
|
1791
|
+
* }
|
|
1792
|
+
* }
|
|
1793
|
+
* ],
|
|
1794
|
+
* "required": false
|
|
1795
|
+
* }
|
|
1796
|
+
* }
|
|
1797
|
+
* }
|
|
1798
|
+
* }
|
|
1799
|
+
* }
|
|
1800
|
+
* ```
|
|
1801
|
+
*
|
|
1802
|
+
* If the same product has different `custom_inputs` attributes, then these are added as separate items in a cart.
|
|
1803
|
+
*
|
|
1804
|
+
* The `custom_inputs` attribute is stored in the cart item and the text for `custom_input` must not exceed 255 characters in length. When a cart is checked out, the `custom_inputs` attribute becomes part of the order.
|
|
1805
|
+
*
|
|
1806
|
+
* #### Limitations on Usage of `custom_inputs` with Specific Promotion Types
|
|
1807
|
+
*
|
|
1808
|
+
* When you add products to a cart with `custom_inputs`, there are certain limitations on usage of the `custom_inputs` with the following promotion types:
|
|
1809
|
+
*
|
|
1810
|
+
* - For [Free Gift Promotions](/docs/api/promotions/create-a-promotion), you can add `custom_inputs` to gift items.
|
|
1811
|
+
* - For [Fixed Bundle Discount Promotions](/docs/api/promotions/create-a-promotion), the promotion applies as long as the cart contains the bundle SKUs even when there are different `custom_inputs`.
|
|
1812
|
+
* - For [X for Y Discount Promotion and X for amount discount promotion](/docs/api/promotions/create-a-promotion), the promotion applies when there are two SKUs with the same `custom_inputs`. The promotion does not apply when there are different `custom_inputs` and the SKUs are in different line items.
|
|
1813
|
+
*
|
|
1814
|
+
* :::note
|
|
1815
|
+
*
|
|
1816
|
+
* - Any requests to add a product to cart returns the collection of cart items.
|
|
1817
|
+
* - [Tax items](/docs/api/carts/tax-items) may optionally be added with the product. Only administrators with [client credentials](/docs/authentication/Tokens/client-credential-token) are able to do this. If included, they replace any existing taxes on the product.
|
|
1818
|
+
* - The cart currency is set when the first item is added to the cart.
|
|
1819
|
+
* - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency.
|
|
1820
|
+
* - A cart can contain a maximum of 100 unique items. Items include products, custom items, tax items, and promotions.
|
|
1821
|
+
* - There are a number of actions that happen to your inventory when checking out and paying for an order. For more information, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) documentation.
|
|
1822
|
+
*
|
|
1823
|
+
* :::
|
|
1824
|
+
*
|
|
1825
|
+
* ### Add Custom Item to Cart
|
|
1826
|
+
*
|
|
1827
|
+
* You can add a custom item to the cart when you don't manage things like shipping, taxes and inventory in Commerce.
|
|
1828
|
+
*
|
|
1829
|
+
* For [Shipping Groups](/docs/ship-groups/shipping-groups), once you have created a [cart shipping group](/docs/ship-groups/shipping-groups/shipping-groups-api/create-cart-shipping-group), you need to link it to the cart items. This is important, because it is necessary to associate items with shipping groups in order to include shipping groups in the corresponding cart, order, and totals.
|
|
1830
|
+
*
|
|
1831
|
+
* :::note
|
|
1832
|
+
*
|
|
1833
|
+
* - Custom Cart Items are available through [implicit authentication](/docs/authentication/Tokens/implicit-token). Ensure that you always check each order has the correct details for each item, most importantly, price.
|
|
1834
|
+
*
|
|
1835
|
+
* :::
|
|
1836
|
+
*
|
|
1837
|
+
* ### Add Promotion to Cart
|
|
1838
|
+
*
|
|
1839
|
+
* You can use the Promotions API to apply discounts to your cart as a special cart item type. Any requests to add a product to cart will return a collection of cart items.
|
|
1840
|
+
*
|
|
1841
|
+
* There are certain limitations on usage of the `custom_inputs` attribute with some promotion types. See [Limitations on Usage of `custom_inputs` with Specific Promotion Types](/docs/api/carts/manage-carts#limitations-on-usage-of-custom_inputs-with-specific-promotion-types).
|
|
1842
|
+
*
|
|
1843
|
+
* To remove promotion from the cart via the promotion code, see [Delete Promotion Code from Cart](/docs/api/carts/delete-a-promotion-via-promotion-code).
|
|
1844
|
+
*
|
|
1845
|
+
* ### Re-order
|
|
1846
|
+
*
|
|
1847
|
+
* From a shopper’s order history, they can add the items from a previous order into their carts. Shoppers can add items regardless of past order status, such as incomplete or not paid. For more information, see [Orders](/docs/api/carts/orders).
|
|
1848
|
+
*
|
|
1849
|
+
* :::note
|
|
1850
|
+
* - Any requests to add an item to cart return a collection of [cart items](/docs/api/carts/cart-items).
|
|
1851
|
+
* - A cart can contain a maximum of 100 unique items. Items include products, custom items, and promotions.
|
|
1852
|
+
* - When a shopper creates a cart and re-orders items from an order with properties such as custom attributes, custom discounts, and payment intent ID, these properties will remain unchanged in the original cart.
|
|
1853
|
+
* - Custom items do not exist in catalogs, and therefore cannot be reordered.
|
|
1854
|
+
* :::
|
|
1855
|
+
*
|
|
1856
|
+
* ### Merging Carts
|
|
1857
|
+
*
|
|
1858
|
+
* A shopper can have multiple carts, and the system may automatically merge items from an anonymous cart into the shopper's registered cart when they sign in. For example, if a shopper has an existing cart with items `A`, `B` and `C`, and later adds items `D` and `E` while not signed in, the system can merge these carts when the shopper signs in. After the carts merge, the cart contains items `A`, `B`, `C`, `D` and `E`.
|
|
1859
|
+
*
|
|
1860
|
+
* If any items are duplicated from the anonymous cart to the registered cart, their quantities are incremented accordingly. For example, if a shopper's existing cart with items `A`, `B` and `C`, and they later add two more `A` items and one `B` item while not signed in, the system will merge the carts when the shopper signs in. The existing cart will now contain three `A` items, two `B` items, and one `C` item.
|
|
1861
|
+
*
|
|
1862
|
+
* :::note
|
|
1863
|
+
*
|
|
1864
|
+
* When the system merges items from one cart into another cart, properties such as custom attributes, custom discounts, and payment intent ID will remain unchanged in the original cart.
|
|
1865
|
+
*
|
|
1866
|
+
* :::
|
|
1867
|
+
*
|
|
1868
|
+
* ### Best Practices
|
|
1869
|
+
*
|
|
1870
|
+
* We recommend to include a unique `sku` code within the request body while adding custom items to carts. If the same `sku` is used for multiple products, they are merged into a single line item.
|
|
1871
|
+
*
|
|
1872
|
+
* For example, if a cart consists of the following items:
|
|
1873
|
+
*
|
|
1874
|
+
* - `product-1` with quantity 1 and sku code as `sku-1`
|
|
1875
|
+
* - `product-2` with quantity 1 and sku code as `sku-1`
|
|
1876
|
+
* - `product-3` with quantity 1 and sku code as `sku-2`.
|
|
1877
|
+
*
|
|
1878
|
+
* The following response is returned where it combines all products with the same sku codes into a single line item, while products with a unique sku codes are represented as separate items:
|
|
1879
|
+
*
|
|
1880
|
+
* ```json
|
|
1881
|
+
* {
|
|
1882
|
+
* "data": [
|
|
1883
|
+
* {
|
|
1884
|
+
* "id": "c58760f4-8889-4719-b34d-be1f1d11ae59",
|
|
1885
|
+
* "type": "custom_item",
|
|
1886
|
+
* "name": "product-1",
|
|
1887
|
+
* "description": "My first custom item!",
|
|
1888
|
+
* "sku": "sku-1",
|
|
1889
|
+
* "slug": "",
|
|
1890
|
+
* "image": {
|
|
1891
|
+
* "mime_type": "",
|
|
1892
|
+
* "file_name": "",
|
|
1893
|
+
* "href": ""
|
|
1894
|
+
* },
|
|
1895
|
+
* "quantity": 2,
|
|
1896
|
+
* "manage_stock": false,
|
|
1897
|
+
* "unit_price": {
|
|
1898
|
+
* "amount": 20000,
|
|
1899
|
+
* "currency": "USD",
|
|
1900
|
+
* "includes_tax": true
|
|
1901
|
+
* },
|
|
1902
|
+
* "value": {
|
|
1903
|
+
* "amount": 40000,
|
|
1904
|
+
* "currency": "USD",
|
|
1905
|
+
* "includes_tax": true
|
|
1906
|
+
* },
|
|
1907
|
+
* "links": {},
|
|
1908
|
+
* "meta": {
|
|
1909
|
+
* "display_price": {
|
|
1910
|
+
* "with_tax": {
|
|
1911
|
+
* "unit": {
|
|
1912
|
+
* "amount": 20000,
|
|
1913
|
+
* "currency": "USD",
|
|
1914
|
+
* "formatted": "$200.00"
|
|
1915
|
+
* },
|
|
1916
|
+
* "value": {
|
|
1917
|
+
* "amount": 40000,
|
|
1918
|
+
* "currency": "USD",
|
|
1919
|
+
* "formatted": "$400.00"
|
|
1920
|
+
* }
|
|
1921
|
+
* },
|
|
1922
|
+
* "without_tax": {
|
|
1923
|
+
* "unit": {
|
|
1924
|
+
* "amount": 20000,
|
|
1925
|
+
* "currency": "USD",
|
|
1926
|
+
* "formatted": "$200.00"
|
|
1927
|
+
* },
|
|
1928
|
+
* "value": {
|
|
1929
|
+
* "amount": 40000,
|
|
1930
|
+
* "currency": "USD",
|
|
1931
|
+
* "formatted": "$400.00"
|
|
1932
|
+
* }
|
|
1933
|
+
* },
|
|
1934
|
+
* "tax": {
|
|
1935
|
+
* "unit": {
|
|
1936
|
+
* "amount": 0,
|
|
1937
|
+
* "currency": "USD",
|
|
1938
|
+
* "formatted": "$0.00"
|
|
1939
|
+
* },
|
|
1940
|
+
* "value": {
|
|
1941
|
+
* "amount": 0,
|
|
1942
|
+
* "currency": "USD",
|
|
1943
|
+
* "formatted": "$0.00"
|
|
1944
|
+
* }
|
|
1945
|
+
* },
|
|
1946
|
+
* "discount": {
|
|
1947
|
+
* "unit": {
|
|
1948
|
+
* "amount": 0,
|
|
1949
|
+
* "currency": "USD",
|
|
1950
|
+
* "formatted": "$0.00"
|
|
1951
|
+
* },
|
|
1952
|
+
* "value": {
|
|
1953
|
+
* "amount": 0,
|
|
1954
|
+
* "currency": "USD",
|
|
1955
|
+
* "formatted": "$0.00"
|
|
1956
|
+
* }
|
|
1957
|
+
* },
|
|
1958
|
+
* "without_discount": {
|
|
1959
|
+
* "unit": {
|
|
1960
|
+
* "amount": 20000,
|
|
1961
|
+
* "currency": "USD",
|
|
1962
|
+
* "formatted": "$200.00"
|
|
1963
|
+
* },
|
|
1964
|
+
* "value": {
|
|
1965
|
+
* "amount": 40000,
|
|
1966
|
+
* "currency": "USD",
|
|
1967
|
+
* "formatted": "$400.00"
|
|
1968
|
+
* }
|
|
1969
|
+
* }
|
|
1970
|
+
* },
|
|
1971
|
+
* "timestamps": {
|
|
1972
|
+
* "created_at": "2023-05-02T16:28:11Z",
|
|
1973
|
+
* "updated_at": "2023-05-02T16:28:18Z"
|
|
1974
|
+
* }
|
|
1975
|
+
* }
|
|
1976
|
+
* }
|
|
1977
|
+
* ```
|
|
1978
|
+
*
|
|
1979
|
+
*/
|
|
1980
|
+
export var manageCarts = function (options) {
|
|
1981
|
+
var _a;
|
|
1982
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
1983
|
+
{
|
|
1984
|
+
scheme: "bearer",
|
|
1985
|
+
type: "http",
|
|
1986
|
+
},
|
|
1987
|
+
], url: "/v2/carts/{cartID}/items" }));
|
|
1988
|
+
};
|
|
1989
|
+
/**
|
|
1990
|
+
* Bulk Update Items in Cart
|
|
1991
|
+
* The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart.
|
|
1992
|
+
*
|
|
1993
|
+
* When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart.
|
|
1994
|
+
*
|
|
1995
|
+
*/
|
|
1996
|
+
export var bulkUpdateItemsInCart = function (options) {
|
|
1997
|
+
var _a;
|
|
1998
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
1999
|
+
{
|
|
2000
|
+
scheme: "bearer",
|
|
2001
|
+
type: "http",
|
|
2002
|
+
},
|
|
2003
|
+
], url: "/v2/carts/{cartID}/items" }));
|
|
2004
|
+
};
|
|
2005
|
+
/**
|
|
2006
|
+
* Delete a Cart Item
|
|
2007
|
+
* Use this endpoint to delete a cart item.
|
|
2008
|
+
*/
|
|
2009
|
+
export var deleteACartItem = function (options) {
|
|
2010
|
+
var _a;
|
|
2011
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2012
|
+
{
|
|
2013
|
+
scheme: "bearer",
|
|
2014
|
+
type: "http",
|
|
2015
|
+
},
|
|
2016
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}" }));
|
|
2017
|
+
};
|
|
2018
|
+
/**
|
|
2019
|
+
* Update a Cart Item
|
|
2020
|
+
* You can easily update a cart item. A successful update returns the cart items.
|
|
2021
|
+
*/
|
|
2022
|
+
export var updateACartItem = function (options) {
|
|
2023
|
+
var _a;
|
|
2024
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2025
|
+
{
|
|
2026
|
+
scheme: "bearer",
|
|
2027
|
+
type: "http",
|
|
2028
|
+
},
|
|
2029
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}" }));
|
|
2030
|
+
};
|
|
2031
|
+
/**
|
|
2032
|
+
* Delete Account Cart Association
|
|
2033
|
+
* You can delete an association between an account and a cart.
|
|
2034
|
+
*/
|
|
2035
|
+
export var deleteAccountCartAssociation = function (options) {
|
|
2036
|
+
var _a;
|
|
2037
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2038
|
+
{
|
|
2039
|
+
scheme: "bearer",
|
|
2040
|
+
type: "http",
|
|
2041
|
+
},
|
|
2042
|
+
], url: "/v2/carts/{cartID}/relationships/accounts" }));
|
|
2043
|
+
};
|
|
2044
|
+
/**
|
|
2045
|
+
* Create an Account Cart Association
|
|
2046
|
+
* You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device.
|
|
2047
|
+
*/
|
|
2048
|
+
export var createAccountCartAssociation = function (options) {
|
|
2049
|
+
var _a;
|
|
2050
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2051
|
+
{
|
|
2052
|
+
scheme: "bearer",
|
|
2053
|
+
type: "http",
|
|
2054
|
+
},
|
|
2055
|
+
], url: "/v2/carts/{cartID}/relationships/accounts" }));
|
|
2056
|
+
};
|
|
2057
|
+
/**
|
|
2058
|
+
* Delete Customer Cart Association
|
|
2059
|
+
* You can delete an association between a customer and a cart.
|
|
2060
|
+
*/
|
|
2061
|
+
export var deleteCustomerCartAssociation = function (options) {
|
|
2062
|
+
var _a;
|
|
2063
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2064
|
+
{
|
|
2065
|
+
scheme: "bearer",
|
|
2066
|
+
type: "http",
|
|
2067
|
+
},
|
|
2068
|
+
], url: "/v2/carts/{cartID}/relationships/customers" }));
|
|
2069
|
+
};
|
|
2070
|
+
/**
|
|
2071
|
+
* Create a Customer Cart Association
|
|
2072
|
+
* You can create associations between a customer and one or more carts. After cart associations exist for a customer, the customer can access those carts across any device.
|
|
2073
|
+
*/
|
|
2074
|
+
export var createCustomerCartAssociation = function (options) {
|
|
2075
|
+
var _a;
|
|
2076
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2077
|
+
{
|
|
2078
|
+
scheme: "bearer",
|
|
2079
|
+
type: "http",
|
|
2080
|
+
},
|
|
2081
|
+
], url: "/v2/carts/{cartID}/relationships/customers" }));
|
|
2082
|
+
};
|
|
2083
|
+
/**
|
|
2084
|
+
* Delete a Promotion via Promotion Code
|
|
2085
|
+
* You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically.
|
|
2086
|
+
*/
|
|
2087
|
+
export var deleteAPromotionViaPromotionCode = function (options) {
|
|
2088
|
+
var _a;
|
|
2089
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2090
|
+
{
|
|
2091
|
+
scheme: "bearer",
|
|
2092
|
+
type: "http",
|
|
2093
|
+
},
|
|
2094
|
+
], url: "/v2/carts/{cartID}/discounts/{promoCode}" }));
|
|
2095
|
+
};
|
|
2096
|
+
/**
|
|
2097
|
+
* Add Tax Item to Cart
|
|
2098
|
+
*
|
|
2099
|
+
* Use this endpoint to add a tax item to a cart.
|
|
2100
|
+
*
|
|
2101
|
+
* :::note
|
|
2102
|
+
*
|
|
2103
|
+
* There is a soft limit of 5 unique tax items per cart item at any one time.
|
|
2104
|
+
*
|
|
2105
|
+
* :::
|
|
2106
|
+
*
|
|
2107
|
+
*/
|
|
2108
|
+
export var addTaxItemToCart = function (options) {
|
|
2109
|
+
var _a;
|
|
2110
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2111
|
+
{
|
|
2112
|
+
scheme: "bearer",
|
|
2113
|
+
type: "http",
|
|
2114
|
+
},
|
|
2115
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes" }));
|
|
2116
|
+
};
|
|
2117
|
+
/**
|
|
2118
|
+
* Bulk Delete Tax Items from Cart
|
|
2119
|
+
* Use this endpoint to bulk delete tax items from cart.
|
|
2120
|
+
*/
|
|
2121
|
+
export var bulkDeleteTaxItemsFromCart = function (options) {
|
|
2122
|
+
var _a;
|
|
2123
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2124
|
+
{
|
|
2125
|
+
scheme: "bearer",
|
|
2126
|
+
type: "http",
|
|
2127
|
+
},
|
|
2128
|
+
], url: "/v2/carts/{cartID}/taxes" }));
|
|
2129
|
+
};
|
|
2130
|
+
/**
|
|
2131
|
+
* Bulk Add Tax Items to Cart
|
|
2132
|
+
* :::note
|
|
2133
|
+
*
|
|
2134
|
+
* A cart item can only have a maximum of five tax items.
|
|
2135
|
+
*
|
|
2136
|
+
* :::
|
|
2137
|
+
*
|
|
2138
|
+
* ### Errors
|
|
2139
|
+
*
|
|
2140
|
+
* `422 Unprocessable Entity`
|
|
2141
|
+
*
|
|
2142
|
+
* In this example, when `options.add_all_or_nothing` is set to `true` and if one of cart items is not found or or has reached its maximum tax item limit, the following error response is returned:
|
|
2143
|
+
*
|
|
2144
|
+
* ```json
|
|
2145
|
+
* {
|
|
2146
|
+
* "status": 422,
|
|
2147
|
+
* "title": "Add all or nothing.",
|
|
2148
|
+
* "detail": "Add all or nothing set to (true). Could not bulk add tax items to cart."
|
|
2149
|
+
* }
|
|
2150
|
+
*
|
|
2151
|
+
* ```
|
|
2152
|
+
*
|
|
2153
|
+
* In this example, if you add more than five tax items to the same cart item, the following error response is returned:
|
|
2154
|
+
*
|
|
2155
|
+
* ```json
|
|
2156
|
+
* {
|
|
2157
|
+
* "status": 422,
|
|
2158
|
+
* "title": "Tax item not added to cart item.",
|
|
2159
|
+
* "detail": "Cannot exceed tax item limit of (5) on cart item.",
|
|
2160
|
+
* "meta": {
|
|
2161
|
+
* "id": "f88e6370-cb35-40b2-a998-c759f31dec0a"
|
|
2162
|
+
* }
|
|
2163
|
+
* }
|
|
2164
|
+
* ```
|
|
2165
|
+
*
|
|
2166
|
+
* `404`
|
|
2167
|
+
*
|
|
2168
|
+
* In this example, if there is a mismatch between `cart_item`/`custom_item` and the `relationships.item.data.type` specified in the bulk add tax item, the following error response is returned:
|
|
2169
|
+
*
|
|
2170
|
+
* ```json
|
|
2171
|
+
* {
|
|
2172
|
+
* "data": [],
|
|
2173
|
+
* "errors": [
|
|
2174
|
+
* {
|
|
2175
|
+
* "status": 404,
|
|
2176
|
+
* "title": "Tax item not added to cart item.",
|
|
2177
|
+
* "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
|
|
2178
|
+
* "meta": {
|
|
2179
|
+
* "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
|
|
2180
|
+
* }
|
|
2181
|
+
* },
|
|
2182
|
+
* {
|
|
2183
|
+
* "status": 404,
|
|
2184
|
+
* "title": "Tax item not added to cart item.",
|
|
2185
|
+
* "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
|
|
2186
|
+
* "meta": {
|
|
2187
|
+
* "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
|
|
2188
|
+
* }
|
|
2189
|
+
* }
|
|
2190
|
+
* ]
|
|
2191
|
+
* }
|
|
2192
|
+
* ```
|
|
2193
|
+
*
|
|
2194
|
+
*/
|
|
2195
|
+
export var bulkAddTaxItemsToCart = function (options) {
|
|
2196
|
+
var _a;
|
|
2197
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2198
|
+
{
|
|
2199
|
+
scheme: "bearer",
|
|
2200
|
+
type: "http",
|
|
2201
|
+
},
|
|
2202
|
+
], url: "/v2/carts/{cartID}/taxes" }));
|
|
2203
|
+
};
|
|
2204
|
+
/**
|
|
2205
|
+
* Delete a Tax Item
|
|
2206
|
+
* Use this endpoint to delete a tax item.
|
|
2207
|
+
*/
|
|
2208
|
+
export var deleteATaxItem = function (options) {
|
|
2209
|
+
var _a;
|
|
2210
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2211
|
+
{
|
|
2212
|
+
scheme: "bearer",
|
|
2213
|
+
type: "http",
|
|
2214
|
+
},
|
|
2215
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" }));
|
|
2216
|
+
};
|
|
2217
|
+
/**
|
|
2218
|
+
* Update a TaxItem
|
|
2219
|
+
* Use this endpoint to update a tax item.
|
|
2220
|
+
*/
|
|
2221
|
+
export var updateATaxItem = function (options) {
|
|
2222
|
+
var _a;
|
|
2223
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2224
|
+
{
|
|
2225
|
+
scheme: "bearer",
|
|
2226
|
+
type: "http",
|
|
2227
|
+
},
|
|
2228
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" }));
|
|
2229
|
+
};
|
|
2230
|
+
/**
|
|
2231
|
+
* Bulk Delete Custom Discounts From Cart
|
|
2232
|
+
* Use this endpoint to bulk delete custom discounts from cart.
|
|
2233
|
+
*/
|
|
2234
|
+
export var bulkDeleteCustomDiscountsFromCart = function (options) {
|
|
2235
|
+
var _a;
|
|
2236
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2237
|
+
{
|
|
2238
|
+
scheme: "bearer",
|
|
2239
|
+
type: "http",
|
|
2240
|
+
},
|
|
2241
|
+
], url: "/v2/carts/{cartID}/custom-discounts" }));
|
|
2242
|
+
};
|
|
2243
|
+
/**
|
|
2244
|
+
* Bulk Add Custom Discounts to Cart
|
|
2245
|
+
* The default value for custom discounts on both the cart and cart items is set to 5 if this parameter is not configured in the store. To verify the custom discount limit value, call [Get all settings](/docs/api/settings/get-v-2-settings) endpoint.
|
|
2246
|
+
*
|
|
2247
|
+
* To increase the custom discount value, contact [Elastic Path Support team](https://support.elasticpath.com/hc/en-us).
|
|
2248
|
+
*
|
|
2249
|
+
*/
|
|
2250
|
+
export var bulkAddCustomDiscountsToCart = function (options) {
|
|
2251
|
+
var _a;
|
|
2252
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2253
|
+
{
|
|
2254
|
+
scheme: "bearer",
|
|
2255
|
+
type: "http",
|
|
2256
|
+
},
|
|
2257
|
+
], url: "/v2/carts/{cartID}/custom-discounts" }));
|
|
2258
|
+
};
|
|
2259
|
+
/**
|
|
2260
|
+
* Delete Custom Discount From Cart
|
|
2261
|
+
* Use this endpoint to delete custom discount from cart.
|
|
2262
|
+
*/
|
|
2263
|
+
export var deleteCustomDiscountFromCart = function (options) {
|
|
2264
|
+
var _a;
|
|
2265
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2266
|
+
{
|
|
2267
|
+
scheme: "bearer",
|
|
2268
|
+
type: "http",
|
|
2269
|
+
},
|
|
2270
|
+
], url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" }));
|
|
2271
|
+
};
|
|
2272
|
+
/**
|
|
2273
|
+
* Update Custom Discount For Cart
|
|
2274
|
+
* Use this endpoint to update a custom discount in your cart.
|
|
2275
|
+
*/
|
|
2276
|
+
export var updateCustomDiscountForCart = function (options) {
|
|
2277
|
+
var _a;
|
|
2278
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2279
|
+
{
|
|
2280
|
+
scheme: "bearer",
|
|
2281
|
+
type: "http",
|
|
2282
|
+
},
|
|
2283
|
+
], url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" }));
|
|
2284
|
+
};
|
|
2285
|
+
/**
|
|
2286
|
+
* Add Custom Discount To Cart Item
|
|
2287
|
+
* Use this endpoint to add a custom discount to cart item.
|
|
2288
|
+
*/
|
|
2289
|
+
export var addCustomDiscountToCartItem = function (options) {
|
|
2290
|
+
var _a;
|
|
2291
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2292
|
+
{
|
|
2293
|
+
scheme: "bearer",
|
|
2294
|
+
type: "http",
|
|
2295
|
+
},
|
|
2296
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts" }));
|
|
2297
|
+
};
|
|
2298
|
+
/**
|
|
2299
|
+
* Delete Custom Discount From Cart Item
|
|
2300
|
+
* Use this endpoint to delete custom discount from cart item.
|
|
2301
|
+
*/
|
|
2302
|
+
export var deleteCustomDiscountFromCartItem = function (options) {
|
|
2303
|
+
var _a;
|
|
2304
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
|
|
2305
|
+
{
|
|
2306
|
+
scheme: "bearer",
|
|
2307
|
+
type: "http",
|
|
2308
|
+
},
|
|
2309
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" }));
|
|
2310
|
+
};
|
|
2311
|
+
/**
|
|
2312
|
+
* Update Custom Discount For Cart Item
|
|
2313
|
+
* Use this endpoint to update a custom discount in your cart item.
|
|
2314
|
+
*/
|
|
2315
|
+
export var updateCustomDiscountForCartItem = function (options) {
|
|
2316
|
+
var _a;
|
|
2317
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2318
|
+
{
|
|
2319
|
+
scheme: "bearer",
|
|
2320
|
+
type: "http",
|
|
2321
|
+
},
|
|
2322
|
+
], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" }));
|
|
2323
|
+
};
|
|
2324
|
+
/**
|
|
2325
|
+
* Create Stripe Payment Intent for a Cart
|
|
2326
|
+
* The Cart Payment Intent feature enables the creation of a Stripe Payment Intent specifically tied to a shopping cart and its subsequent order. This allows Payment Intent users to track payment details from the cart stage and seamlessly maintain consistency in payment information throughout the order stage. Using these features, you can create Payment Intents for their carts, update Payment Intents with final cart details, and synchronize Payment Intents from Stripe to Commerce.
|
|
2327
|
+
*
|
|
2328
|
+
* :::note
|
|
2329
|
+
*
|
|
2330
|
+
* - Typically, in Commerce, inventory is allocated at the time of payment initiation after an order is created. However, in the case of Cart Payment Intent, information about the payment is received only upon synchronizing the order from Stripe to Commerce. This may happen after the payment is completed. Therefore, there might be a delay between the payment made and allocation, increasing the chance of paying for items that are not in stock.
|
|
2331
|
+
* - There are certain fields you can choose to set up when [creating a payment intent](https://stripe.com/docs/api/payment_intents/create). However, if you decide to update a payment intent, the available options may not be the same as those allowed while creating a payment intent. See [updating a payment intent](https://stripe.com/docs/api/payment_intents/update).
|
|
2332
|
+
*
|
|
2333
|
+
* :::
|
|
2334
|
+
*
|
|
2335
|
+
* The following steps outline the workflow associated with the Payment Intent:
|
|
2336
|
+
*
|
|
2337
|
+
* 1. [Add items to cart](/docs/api/carts/manage-carts#add-custom-item-to-cart).
|
|
2338
|
+
* 1. [Create a Payment Intent for the cart](/docs/api/carts/create-cart-payment-intent). The Payment Intent is created in Stripe, reflecting the cart and transaction details, including currency, amounts, payment type, and any optional Stripe details. The Payment Intent ID is generated and linked to the cart.
|
|
2339
|
+
* 1. [Update a Payment Intent](/docs/carts-orders/update-cart-payment-intent). This step is optional but becomes necessary when there are changes in the cart details at the time of payment. It ensures the Payment Intent accurately reflects the current cart details when processing the payments on the front end.
|
|
2340
|
+
* 1. [Checkout the cart](/docs/api/carts/checkout). An unpaid order is created, and the Payment Intent ID is linked to the order.
|
|
2341
|
+
* 1. [Confirm the order](/docs/carts-orders/confirm-an-order). This is important because after checkout, it is essential to confirm the Payment Intent and synchronize it with Commerce. This results in a corresponding transaction and change in order statuses in Commerce. Additionally, the Payment Intent ID is removed from the order once it is linked via the transaction.
|
|
2342
|
+
*
|
|
2343
|
+
* ### Best Practices
|
|
2344
|
+
*
|
|
2345
|
+
* We recommend you follow these practices to maintain consistency and accuracy when using Cart Payment Intent.
|
|
2346
|
+
*
|
|
2347
|
+
* - After checkout, we recommend clearing the shopping cart. You can achieve this using a [Delete a cart](/docs/api/carts/delete-a-cart) endpoint or [Update a cart](/docs/api/carts/update-a-cart) to remove the Payment Intent ID. This helps to avoid potential issues where subsequent checkouts for the same cart might unintentionally use the previous Stripe Payment Intent ID.
|
|
2348
|
+
* - If it is not reasonable to clear the cart immediately after checkout due to several subsequent, duplicate checkouts to the same cart, ensure that you only synchronize the Payment Intent when finalizing the order. Each order confirmation is unaware of the others, and syncing Payment Intent IDs for each confirmation can lead to duplicate transactions in Commerce. In other words, if you synchronize Payment Intents for earlier versions of a repeated checkout, you'll end up with multiple orders from the same cart, each having transactions linked to the same Payment Intent.
|
|
2349
|
+
* - To pay the entire amount at once, use the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to update the Stripe Payment Intent with the final cart details when preparing to take the payment. Doing so, ensures that the Payment Intent accurately reflects the current cart details when processing payments on the front end. We do not recommend calling the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) for each individual change in the cart, as this can lead to more requests and may slow down the front-end performance.
|
|
2350
|
+
*
|
|
2351
|
+
*/
|
|
2352
|
+
export var createCartPaymentIntent = function (options) {
|
|
2353
|
+
var _a;
|
|
2354
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2355
|
+
{
|
|
2356
|
+
scheme: "bearer",
|
|
2357
|
+
type: "http",
|
|
2358
|
+
},
|
|
2359
|
+
], url: "/v2/carts/{cartID}/payments" }));
|
|
2360
|
+
};
|
|
2361
|
+
/**
|
|
2362
|
+
* Checkout API
|
|
2363
|
+
* When a Cart is ready for checkout, you can convert the cart to an order. The cart remains and can be modified and checked out again if required.
|
|
2364
|
+
*
|
|
2365
|
+
* A cart can be checked out with a customer ID, customer object, or with an account by authenticating with the `Client Credentials Token`.
|
|
2366
|
+
*
|
|
2367
|
+
* After a successful checkout, a response that contains the order is returned. If the cart is linked to a shipping group, the shipping group is also associated with the order after checkout.
|
|
2368
|
+
*
|
|
2369
|
+
* You can checkout using one of the following methods:
|
|
2370
|
+
* - Customer ID. You can checkout a cart with an existing customer ID.
|
|
2371
|
+
* - Guest Checkout (Checkout with Customer Object). You can checkout a cart with an associated customer name and email.
|
|
2372
|
+
* - Checkout with Account. The shopper authenticates with the `Client Credentials` Token.
|
|
2373
|
+
* - Checkout with Account Management Authentication Token. The shopper authenticates with the `Implicit Token` and the `EP-Account-Management-Authentication-Token`.
|
|
2374
|
+
*
|
|
2375
|
+
* :::note
|
|
2376
|
+
*
|
|
2377
|
+
* - The cart currency is set when the first item is added to the cart.
|
|
2378
|
+
* - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency.
|
|
2379
|
+
* - To ensure that a free gift is automatically applied to an order, set the promotion to automatic. The checkout process will not be successful if free gift items are out of stock. See [Errors](#errors) section.
|
|
2380
|
+
*
|
|
2381
|
+
* :::
|
|
2382
|
+
*
|
|
2383
|
+
* :::caution
|
|
2384
|
+
*
|
|
2385
|
+
* - By default, carts are automatically deleted 7 days after the last update. You can change this setting by [updating cart settings](/docs/api/settings/put-v-2-settings-cart).
|
|
2386
|
+
* - Your inventory is modified during checkout and payment of an order. For more information about the changes in the inventory, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) section.
|
|
2387
|
+
*
|
|
2388
|
+
* :::
|
|
2389
|
+
*
|
|
2390
|
+
* ### Next Steps
|
|
2391
|
+
*
|
|
2392
|
+
* After a cart has been converted to an Order using either of the previous methods, you most likely want to capture payment for order. See [Paying for an Order](/docs/api/carts/payments).
|
|
2393
|
+
*
|
|
2394
|
+
* ### Errors
|
|
2395
|
+
*
|
|
2396
|
+
* The following error response is returned during checkout when an eligible item is added to the cart, and the free gift is out of stock.
|
|
2397
|
+
*
|
|
2398
|
+
* ```json
|
|
2399
|
+
* {
|
|
2400
|
+
* "errors": [
|
|
2401
|
+
* {
|
|
2402
|
+
* "status": 400,
|
|
2403
|
+
* "title": "Insufficient stock",
|
|
2404
|
+
* "detail": "There is not enough stock to add gift2 to your cart",
|
|
2405
|
+
* "meta": {
|
|
2406
|
+
* "id": "f2b68648-9621-45a3-aed6-1b526b0f5beb",
|
|
2407
|
+
* "sku": "gift2"
|
|
2408
|
+
* }
|
|
2409
|
+
* }
|
|
2410
|
+
* ]
|
|
2411
|
+
* }
|
|
2412
|
+
* ```
|
|
2413
|
+
*
|
|
2414
|
+
*/
|
|
2415
|
+
export var checkoutApi = function (options) {
|
|
2416
|
+
var _a;
|
|
2417
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2418
|
+
{
|
|
2419
|
+
scheme: "bearer",
|
|
2420
|
+
type: "http",
|
|
2421
|
+
},
|
|
2422
|
+
], url: "/v2/carts/{cartID}/checkout" }));
|
|
2423
|
+
};
|
|
2424
|
+
/**
|
|
2425
|
+
* Get All Orders
|
|
2426
|
+
* This endpoint returns all orders with custom flow fields. The pagination offset is set to fetch a maximum of 10,000 orders. If the store has 10,000 orders and you fetch the orders without using filters, an error is returned. Use a filter to view orders when the order is beyond the 10,000 mark.
|
|
2427
|
+
*
|
|
2428
|
+
* :::note
|
|
2429
|
+
*
|
|
2430
|
+
* - Pass the `X-Moltin-Customer-Token` header to limit orders to a specific customer. See [Customer Tokens](/docs/customer-management/customer-management-api/customer-tokens).
|
|
2431
|
+
* - Pass the `EP-Account-Management-Authentication-Token` header to limit orders to a specific account. See [Account Management Token](/docs/api/accounts/post-v-2-account-members-tokens).
|
|
2432
|
+
* - You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination).
|
|
2433
|
+
*
|
|
2434
|
+
* :::
|
|
2435
|
+
*
|
|
2436
|
+
* ### Filtering
|
|
2437
|
+
*
|
|
2438
|
+
* The following operators and attributes are available for filtering orders.
|
|
2439
|
+
*
|
|
2440
|
+
* | Attribute | Type | Operator | Example |
|
|
2441
|
+
* | :--- | :--- | :--- | :--- |
|
|
2442
|
+
* | `status` | `string` | `eq` | `eq(status,complete)` |
|
|
2443
|
+
* | `payment` | `string` | `eq` | `eq(payment,paid)` |
|
|
2444
|
+
* | `shipping` | `string` | `eq` | `eq(shipping,unfulfilled)` |
|
|
2445
|
+
* | `name` (`customer.name`) | `string` | `eq` / `like` | `like(name,Brad*)` |
|
|
2446
|
+
* | `email` (`customer.email`) | `string` | `eq` / `like` | `like(email,*@elasticpath.com)` |
|
|
2447
|
+
* | `customer_id` | `string` | `eq` / `like` | `eq(customer_id, e5a0d684-a4af-4919-a348-f66b0b4955e0)` |
|
|
2448
|
+
* | `account_id` | `string` | `eq` / `like` | `eq(account_id,3d7200c9-a9bc-4085-9822-63e80fd94a09)` |
|
|
2449
|
+
* | `account_member_id` | `string` | `eq` / `like` | `eq(account_member_id,2a8a3a92-2ccd-4b2b-a7af-52d3896eaecb)` |
|
|
2450
|
+
* | `contact.name` | `string` | `eq` / `like` | `eq(name,John Doe)` |
|
|
2451
|
+
* | `contact.email` | `string` | `eq` / `like` | `eq(email,John Doe)` |
|
|
2452
|
+
* | `shipping_postcode` | `string` | `eq` / `like` | `like(shipping_postcode,117*)` |
|
|
2453
|
+
* | `billing_postcode` | `string` | `eq` / `like` | `like(billing_postcode,117*)` |
|
|
2454
|
+
* | `with_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(with_tax,10000)` |
|
|
2455
|
+
* | `without_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(without_tax,10000)` |
|
|
2456
|
+
* | `currency` | `string` | `eq` | `eq(currency,USD)` |
|
|
2457
|
+
* | `product_id` | `string` | `eq` | `eq(product_id,6837058c-ae42-46db-b3c6-7f01e0c34b40)` |
|
|
2458
|
+
* | `product_sku` | `string` | `eq` | `eq(product_sku,deck-shoe-001)` |
|
|
2459
|
+
* | `created_at` | `date` | `eq` / `gt` / `ge`/ `le` / `lt` | `gt(created_at,YYYY-MM-DD)` |
|
|
2460
|
+
* | `updated_at` | `date` | `eq` / `gt` / `ge`/ `le`/ `lt` | `lt(updated_at,YYYY-MM-DD)` |
|
|
2461
|
+
* | `external_ref` | `string` | `eq` / `like` | `like(external_ref, 16be*)` |
|
|
2462
|
+
*
|
|
2463
|
+
*/
|
|
2464
|
+
export var getCustomerOrders = function (options) {
|
|
2465
|
+
var _a;
|
|
2466
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
2467
|
+
{
|
|
2468
|
+
scheme: "bearer",
|
|
2469
|
+
type: "http",
|
|
2470
|
+
},
|
|
2471
|
+
], url: "/v2/orders" }));
|
|
2472
|
+
};
|
|
2473
|
+
/**
|
|
2474
|
+
* Get an Order
|
|
2475
|
+
* Use this endpoint to retrieve a specific order.
|
|
2476
|
+
*/
|
|
2477
|
+
export var getAnOrder = function (options) {
|
|
2478
|
+
var _a;
|
|
2479
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
2480
|
+
{
|
|
2481
|
+
scheme: "bearer",
|
|
2482
|
+
type: "http",
|
|
2483
|
+
},
|
|
2484
|
+
], url: "/v2/orders/{orderID}" }));
|
|
2485
|
+
};
|
|
2486
|
+
/**
|
|
2487
|
+
* Update an Order
|
|
2488
|
+
* You can only update custom data, `shipping`, `shipping_address`, and status on orders. All other settings in the order object are immutable.
|
|
2489
|
+
*
|
|
2490
|
+
* :::caution
|
|
2491
|
+
*
|
|
2492
|
+
* You can update `shipping`, `shipping_address`, and status of an order only if the order is not fulfilled. You can use the refund API to refund an order only if the payment status is `paid`. Canceling an order does not automatically refund a payment. You must refund the orders manually.
|
|
2493
|
+
*
|
|
2494
|
+
* :::
|
|
2495
|
+
*
|
|
2496
|
+
* :::note
|
|
2497
|
+
*
|
|
2498
|
+
* - This request is only accessible to client credentials token users with Seller Admin role.
|
|
2499
|
+
* - Non client credentials token users cannot access this endpoint. See [Permissions](/docs/authentication/Tokens/permissions).
|
|
2500
|
+
*
|
|
2501
|
+
* :::
|
|
2502
|
+
*
|
|
2503
|
+
*/
|
|
2504
|
+
export var updateAnOrder = function (options) {
|
|
2505
|
+
var _a;
|
|
2506
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2507
|
+
{
|
|
2508
|
+
scheme: "bearer",
|
|
2509
|
+
type: "http",
|
|
2510
|
+
},
|
|
2511
|
+
], url: "/v2/orders/{orderID}" }));
|
|
2512
|
+
};
|
|
2513
|
+
/**
|
|
2514
|
+
* Get Order Items
|
|
2515
|
+
* Use this endpoint to retrieve order items.
|
|
2516
|
+
*/
|
|
2517
|
+
export var getOrderItems = function (options) {
|
|
2518
|
+
var _a;
|
|
2519
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
2520
|
+
{
|
|
2521
|
+
scheme: "bearer",
|
|
2522
|
+
type: "http",
|
|
2523
|
+
},
|
|
2524
|
+
], url: "/v2/orders/{orderID}/items" }));
|
|
2525
|
+
};
|
|
2526
|
+
/**
|
|
2527
|
+
* Anonymize Orders
|
|
2528
|
+
* You can anonymize an order when it is fulfilled, canceled, or fully refunded.
|
|
2529
|
+
*
|
|
2530
|
+
* When anonymization is successful, Personal Identifiable Information such as customer details, `shipping_address`, and `billing_address` are replaced with *.
|
|
2531
|
+
*
|
|
2532
|
+
*/
|
|
2533
|
+
export var anonymizeOrders = function (options) {
|
|
2534
|
+
var _a;
|
|
2535
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2536
|
+
{
|
|
2537
|
+
scheme: "bearer",
|
|
2538
|
+
type: "http",
|
|
2539
|
+
},
|
|
2540
|
+
], url: "/v2/orders/anonymize" }));
|
|
2541
|
+
};
|
|
2542
|
+
/**
|
|
2543
|
+
* Authorize Setup
|
|
2544
|
+
* Authorize setup
|
|
2545
|
+
*/
|
|
2546
|
+
export var authorizeSetup = function (options) {
|
|
2547
|
+
var _a;
|
|
2548
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2549
|
+
{
|
|
2550
|
+
scheme: "bearer",
|
|
2551
|
+
type: "http",
|
|
2552
|
+
},
|
|
2553
|
+
], url: "/v2/orders/{orderID}/payments" }));
|
|
2554
|
+
};
|
|
2555
|
+
/**
|
|
2556
|
+
* Confirm Setup
|
|
2557
|
+
* Confirm setup
|
|
2558
|
+
*/
|
|
2559
|
+
export var confirmSetup = function (options) {
|
|
2560
|
+
var _a;
|
|
2561
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2562
|
+
{
|
|
2563
|
+
scheme: "bearer",
|
|
2564
|
+
type: "http",
|
|
2565
|
+
},
|
|
2566
|
+
], url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm" }));
|
|
2567
|
+
};
|
|
2568
|
+
/**
|
|
2569
|
+
* Capture a Transaction
|
|
2570
|
+
* Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway.
|
|
2571
|
+
*/
|
|
2572
|
+
export var captureATransaction = function (options) {
|
|
2573
|
+
var _a;
|
|
2574
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2575
|
+
{
|
|
2576
|
+
scheme: "bearer",
|
|
2577
|
+
type: "http",
|
|
2578
|
+
},
|
|
2579
|
+
], url: "/v2/orders/{orderID}/transactions/{transactionID}/capture" }));
|
|
2580
|
+
};
|
|
2581
|
+
/**
|
|
2582
|
+
* Refund a Transaction
|
|
2583
|
+
* There are two ways to refund; through your payment gateway and mark it refunded in Commerce Manager, or directly through Commerce Manager or API.
|
|
2584
|
+
*
|
|
2585
|
+
* * Mark as Refunded: You can manually mark a transaction as refunded. Before you can mark the order as refunded, you need to handle the actual refund on your side with your payment provider. Mark as Refunded is a full refund made to the transaction.
|
|
2586
|
+
* * Refund through Composable Commerce: You can process a full or partial refund to a supported payment provider directly from Commerce Manager or API by providing the refund amount. When you start the refund process, the request is directly sent to the payment gateway.
|
|
2587
|
+
*
|
|
2588
|
+
* :::caution
|
|
2589
|
+
*
|
|
2590
|
+
* If you use manual gateway for partial or full refund, you need to handle the actual refund on your side with your payment provider.
|
|
2591
|
+
*
|
|
2592
|
+
* :::
|
|
2593
|
+
*
|
|
2594
|
+
*/
|
|
2595
|
+
export var refundATransaction = function (options) {
|
|
2596
|
+
var _a;
|
|
2597
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2598
|
+
{
|
|
2599
|
+
scheme: "bearer",
|
|
2600
|
+
type: "http",
|
|
2601
|
+
},
|
|
2602
|
+
], url: "/v2/orders/{orderID}/transactions/{transactionID}/refund" }));
|
|
2603
|
+
};
|
|
2604
|
+
/**
|
|
2605
|
+
* Get Order Transactions
|
|
2606
|
+
* Get order transactions
|
|
2607
|
+
*/
|
|
2608
|
+
export var getOrderTransactions = function (options) {
|
|
2609
|
+
var _a;
|
|
2610
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
2611
|
+
{
|
|
2612
|
+
scheme: "bearer",
|
|
2613
|
+
type: "http",
|
|
2614
|
+
},
|
|
2615
|
+
], url: "/v2/orders/{orderID}/transactions" }));
|
|
2616
|
+
};
|
|
2617
|
+
/**
|
|
2618
|
+
* Get a Transaction
|
|
2619
|
+
* Retrieves a transaction
|
|
2620
|
+
*/
|
|
2621
|
+
export var getATransaction = function (options) {
|
|
2622
|
+
var _a;
|
|
2623
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
|
|
2624
|
+
{
|
|
2625
|
+
scheme: "bearer",
|
|
2626
|
+
type: "http",
|
|
2627
|
+
},
|
|
2628
|
+
], url: "/v2/orders/{orderID}/transactions/{transactionID}" }));
|
|
2629
|
+
};
|
|
2630
|
+
/**
|
|
2631
|
+
* Cancel a Transaction
|
|
2632
|
+
* Use this endpoint to cancel or void a pending or authorized transaction. The transaction can be canceled or voided when it is in `pending` and `completed` statuses.
|
|
2633
|
+
*
|
|
2634
|
+
* :::caution
|
|
2635
|
+
*
|
|
2636
|
+
* This endpoint works only for Stripe and PayPal and does not work for manual gateway.
|
|
2637
|
+
*
|
|
2638
|
+
* :::
|
|
2639
|
+
*
|
|
2640
|
+
*/
|
|
2641
|
+
export var cancelATransaction = function (options) {
|
|
2642
|
+
var _a;
|
|
2643
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
|
|
2644
|
+
{
|
|
2645
|
+
scheme: "bearer",
|
|
2646
|
+
type: "http",
|
|
2647
|
+
},
|
|
2648
|
+
], url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel" }));
|
|
2649
|
+
};
|