Skip to main content

Mutations

The root Mutation type in a GraphQL schema defines all the write operations that can change data. It is analogous to performing HTTP verbs such as POST, PATCH, and DELETE.

Mutations can take arguments as input similar to the body of a POST request in REST. Like GraphQL queries, mutations can also return fields. This can be useful for fetching the new state of an object after an update.

FieldArgumentTypeDescription
updatePricePrice!

Updates a price.

idID!
inputInputUpdatePrice!
archivePricePrice!

Archives a price.

idID!

Specifies the price to archive.

createProductProduct!

When performing the mutation createProduct, we will try to correct you product information as simple as possible without throwing errors, so when you assign a beerType to a wine product for example, we will ignore that to preserve the data integrity.

inputInputCreateProduct!

Specifies the fields to use when creating the product.

updateProductProduct!

Same as createProduct, when performing the mutation updateProduct, we will try to correct you product information as possible without throwing errors, so when you chagne the Product kind from beer to wine for example, we will nullify all the beer related informations for you, to preserve the data integrity.

idID!
inputInputUpdateProduct!

Specifies the fields to use when updating the product.

archiveProductProduct!

When performing the mutation archiveProduct, we will archive the product and all it's variants.

idID!
unarchiveProductProduct!

When performing the mutation unarchiveProduct, we will unarchive the product.

idID!
createStockActivityStockActivity!

When performing the mutation createStockActivity, the stock property of the related Variant will be updated (added or removed) according to the movement made in that mutation.

note

To understand the use of the createStockActivity mutation, you can refer to this guide.

inputInputCreateStockActivity!

Specifies the fields to use when creating the stock activity.

createVariantVariant!

It is necessary to understand that the changes in the creation and updating of the Variant will also create/update/archive the VariantPrice. Although both represent two different schemas, the VariantPrice schema is dependent on the Variant schema.

These mutations manage the insertion and updating of the information related to the product variants and the prices applied to it.

inputInputCreateVariant!
variantPricesInput[InputCreateVariantPrices!]!
updateVariantVariant!

As createVariant, when performing updateVariant, it will also create/update/archive the variant prices.

idID!
inputInputUpdateVariant!

Specifies the fields to use when updating the variant.

variantPricesInput[InputUpdateVariantPrices!]
activateVariantVariant!
idID!
deactivateVariantVariant!
idID!
archiveVariantVariant!
idID!
unarchiveVariantVariant!
idID!