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

Commit

Permalink
Example of using customizable options on add to cart request
Browse files Browse the repository at this point in the history
  • Loading branch information
rogyar committed Apr 23, 2019
1 parent dff7141 commit 5895a57
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 @@ -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

0 comments on commit 5895a57

Please sign in to comment.