Skip to content

Set Shipping Method ​

Set the shipping method for a cart.

Authentication ​

This query supports both authenticated customers and guest users:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
  • Guest users: Provide the Guest Cart Token cartToken obtained from the Create Cart mutation.
Authorization: Bearer <accessToken>

Arguments ​

NameTypeRequiredDescription
shippingMethodString✅ YesShipping method code (e.g., flatrate_flatrate)

Response ​

FieldTypeDescription
successBooleanSuccess status
idStringShipping method ID
messageStringSuccess or error message

Common Shipping Method Codes ​

CodeDescription
flatrate_flatrateFlat Rate - Fixed shipping cost
free_freeFree Shipping - No shipping charge

Prerequisites ​

  • Shipping address must be set before this mutation
  • Available shipping methods depend on:
    • Cart items
    • Shipping address country/region
    • Store configuration

Validation Rules ​

  • Shipping method code must be valid and available
  • Shipping address must be set
  • Cart must have items

Error Responses ​

json
{
  "errors": {
    "shippingMethod": ["Invalid or unavailable shipping method."],
    "shippingAddress": ["Shipping address must be set first."]
  }
}

Released under the MIT License.