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

[GraphQl] Example of using customizable options on add to cart request #4316

Merged
merged 1 commit into from
May 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions guides/v2.3/graphql/reference/quote.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,82 @@ mutation {
}
```

### Adding simple product with customizable options to a cart

If a product has a customizable option, the option's value can be specified in the add to cart request.

**Request**

``` text
mutation {
addSimpleProductsToCart (input: {
cart_id: "nu31JXR9DaqbdVqFDGnqjrMJmUnT3mzB"
cartItems: {
data: {
sku:"simple"
qty:1
},
customizable_options: [
{
id: 121
value: "field value"
}
]
}
}) {
cart {
items {
product {
name
}
qty

... on SimpleCartItem {
customizable_options {
label
values {
value
}
}
}
}
}
}
}
```

**Response**

```text
{
"data": {
"addSimpleProductsToCart": {
"cart": {
"items": [
{
"product": {
"name": "simple"
},
"qty": 2,
"customizable_options": [
{
"label": "Field Option",
"values": [
{
"value": "field value"
}
]
}
]
}
]
}
}
}
}
```


### Updating billing and shipping information
{:.no_toc}

Expand Down