Arguments

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.


Returns

CartResponse.*

Any requested field from the CartResponse object.

Example - request

Query arguments
{
    "input": {
        "id": "{{cart_id}}",
        "shippingOptions": [ 
            { 
            "store": "{{store_domain}}", 
            "shippingId": "{{shipping_id}}}" 
            } 
        ]
    }
}
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_FOUNDerror is returned

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"
                }
            ]
        }
    }
}