> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "updateCartSelectedShippingOptions"
description: "Updates shipping methods for stores in the cart"
---

### Arguments

<ParamField path="input" type={<a href="/api-reference/updatecartselectedshippingoptionsinput">UpdateCartSelectedShippingOptionsInput!</a>} required>
  The `input` object contains the unique identifier (`ID`) for the cart and an array of shipping options associated with a store the shipping belongs to.
</ParamField>

<Note>[`SelectedShippingOption.store`](/api-reference/selectedshippingoption#fields)must be the same as as [`AmazonStore.store`](/api-reference/amazonstore#fields) or [`ShopifyStore.store`](/api-reference/shopifystore#fields) fields</Note>

***

### Returns

<ParamField path="CartResponse.*" type={<a href="/api-reference/cartresponse">CartResponse</a>}>
  Any requested field from the [`CartResponse`](/api-reference/cartresponse) object.
</ParamField>

### Example - request

```json Query arguments
{
    "input": {
        "id": "{{cart_id}}",
        "shippingOptions": [ 
            { 
            "store": "{{store_domain}}", 
            "shippingId": "{{shipping_id}}}" 
            } 
        ]
    }
}
```

```GraphQL GraphQL
mutation ($input: UpdateCartSelectedShippingOptionsInput!) {
    updateCartSelectedShippingOptions(input: $input) {
        cart {
            id
            buyerIdentity {
                firstName
                lastName
                address1
                address2
                city
                provinceCode
                countryCode
                postalCode
                email
                phone
            }
            stores {
                ... on AmazonStore {
                    errors {
                        code
                        message
                        details {
                            productIds
                        }
                    }
                    store
                    cartLines {
                        quantity
                        product {
                            id
                        }
                    }
                    offer {
                        selectedShippingMethod {
                            id
                            label
                            price {
                                displayValue
                                value
                                currency
                            }
                            taxes {
                                displayValue
                                value
                                currency
                            }
                            total {
                                displayValue
                                value
                                currency
                            }
                        }
                        errors {
                            code
                            message
                            details {
                                ... on AmazonOfferErrorDetails {
                                productIds
                            }
                            }
                        }
                        subtotal {
                            value
                            displayValue
                            currency
                        }
                        margin {
                            value
                            displayValue
                            currency
                        }
                        notAvailableIds
                        shippingMethods {
                            id
                            label
                            price {
                                value
                                displayValue
                                currency
                            }
                            taxes {
                                value
                                displayValue
                                currency
                            }
                            total {
                                value
                                displayValue
                                currency
                            }
                        }
                    }
                }
                ... on ShopifyStore {
                    errors {
                        code
                        message
                        details {
                            variantIds
                        }
                    }
                    store
                    cartLines {
                        quantity
                        variant {
                            id
                        }
                    }
                    offer {
                        errors {
                            code
                            message
                            details {
                                ... on ShopifyOfferErrorDetails {
                                variantIds
                            }
                            }
                        }
                        selectedShippingMethod {
                            id
                            label
                            price {
                                displayValue
                                value
                                currency
                            }
                            taxes {
                                displayValue
                                value
                                currency
                            }
                            total {
                                displayValue
                                value
                                currency
                            }
                        }
                        subtotal {
                            value
                            displayValue
                            currency
                        }
                        margin {
                            value
                            displayValue
                            currency
                        }
                        notAvailableIds
                        shippingMethods {
                            id
                            label
                            price {
                                value
                                displayValue
                                currency
                            }
                            taxes {
                                value
                                displayValue
                                currency
                            }
                            total {
                                value
                                displayValue
                                currency
                            }
                        }
                    }
                }
            }
        }
        errors {
            code
            message
        }
    }
}
```

***

### Errors

If the provided store is not present in the cart then `STORE_NOT_FOUND`error is returned

```JSON JSON
{
    "data": {
        "updateCartSelectedShippingOptions": {
            "cart": {
                "id": "0OSTHkAAhrGxr9nBN33c",
                "stores": [
                    {
                        "errors": [],
                        "store": "rye-test-store.myshopify.com",
                        "cartLines": [
                            {
                                "quantity": 1,
                                "variant": {
                                    "id": "39943631962199"
                                }
                            }
                        ]
                    }
                ]
            },
            "errors": [
                {
                    "code": "STORE_NOT_FOUND",
                    "message": "store NonExistingStore not found"
                }
            ]
        }
    }
}
```


---

*Powered by [holocron.so](https://holocron.so)*
