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

Commit

Permalink
Merge pull request #4316 from rogyar/customizable-opts-example-graphql
Browse files Browse the repository at this point in the history
[GraphQl] Example of using customizable options on add to cart request
  • Loading branch information
keharper authored May 7, 2019
2 parents 526a662 + 5895a57 commit a4d076a
Showing 1 changed file with 76 additions and 0 deletions.
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 @@ -215,6 +215,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

0 comments on commit a4d076a

Please sign in to comment.