Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 5895a57

Browse files
committed
Example of using customizable options on add to cart request
1 parent dff7141 commit 5895a57

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

guides/v2.3/graphql/reference/quote.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,82 @@ mutation {
220220
}
221221
```
222222

223+
### Adding simple product with customizable options to a cart
224+
225+
If a product has a customizable option, the option's value can be specified in the add to cart request.
226+
227+
**Request**
228+
229+
``` text
230+
mutation {
231+
addSimpleProductsToCart (input: {
232+
cart_id: "nu31JXR9DaqbdVqFDGnqjrMJmUnT3mzB"
233+
cartItems: {
234+
data: {
235+
sku:"simple"
236+
qty:1
237+
},
238+
customizable_options: [
239+
{
240+
id: 121
241+
value: "field value"
242+
}
243+
]
244+
}
245+
}) {
246+
cart {
247+
items {
248+
product {
249+
name
250+
}
251+
qty
252+
253+
... on SimpleCartItem {
254+
customizable_options {
255+
label
256+
values {
257+
value
258+
}
259+
}
260+
}
261+
}
262+
}
263+
}
264+
}
265+
```
266+
267+
**Response**
268+
269+
```text
270+
{
271+
"data": {
272+
"addSimpleProductsToCart": {
273+
"cart": {
274+
"items": [
275+
{
276+
"product": {
277+
"name": "simple"
278+
},
279+
"qty": 2,
280+
"customizable_options": [
281+
{
282+
"label": "Field Option",
283+
"values": [
284+
{
285+
"value": "field value"
286+
}
287+
]
288+
}
289+
]
290+
}
291+
]
292+
}
293+
}
294+
}
295+
}
296+
```
297+
298+
223299
### Updating billing and shipping information
224300
{:.no_toc}
225301

0 commit comments

Comments
 (0)