createRate
View as MarkdownCreate a new rate.
mutation
Requires commerce.tax:create.
Create a new rate.
value is a union. Select value { __typename ... on RatePercentage { percentage } ... on RateAmount { amount { value currencyCode } } }. There is no value { rate } field. metafields and references are optional — omit them. If you send metafields, the array must be nonempty; [] is rejected. Prefer type: "string" (lowercase).For
SimpleMoneyInput.value, send 1999 for $19.99 USD, not 19.99.Required headers
| Header | Required | Description |
|---|---|---|
x-store-id | Yes | ID of the store the operation targets. Omitting it returns HTTP 200 with a GraphQL error: extensions.code: "UNAUTHENTICATED". |
Go to Authentication for credential setup.
Arguments
inputMutationCreateRateInput!requiredlabelString!required — A label for display.valueRateValueInput!required — The rate's value. Setpercentageoramount, not both. Foramount.valueuse integer minor units.amountSimpleMoneyInputoptional — The rate value represented as a fixed money amount. Required ifpercentageis not provided.percentageStringoptional — The percentage applied by the rate, out of 100. Required ifamountis not provided.
calculationMethodRateCalculationMethodEnumoptional — The method to be used when applying the rate to a purchase amount.createdAtDateTimeoptional — WARNING: DO NOT USE. Deprecated: This field is deprecated and only used for Tax v1 to v2 migration syncs.descriptionStringoptional — A human-friendly description.jurisdictionIdIDoptional — The ID of the jurisdiction in which this rate applies.metafields[CreateMetafieldInput!]optional — Any metafields to be created and assigned to the new rate.keyString!requirednamespaceString!requiredtypeString!required — Metafield value type. Prefer lowercase values such asstring. Catalog rejects uppercaseSTRING; Tax currently accepts both.valueString!required
nameStringoptional — A unique human-friendly identifier. If omitted, a name will be generated from thelabelvalue.references[CreateReferenceInput!]optional — Any references to be created and assigned to the new rate.originString!required — The origin of the reference.valueString!required — The value of the reference.
statusRateStatusEnumoptional — The desired status.updatedAtDateTimeoptional — WARNING: DO NOT USE. Deprecated: This field is deprecated and only used for Tax v1 to v2 migration syncs.
Possible returns
RateRate— An individual tax rate.
Last updated on
How is this guide?