LogoLogo
User ManualChangelogRoadmapAboutYouTube
GraphQL API
GraphQL API
  • GraphQL API
  • Overview
    • Query types
      • Stream queries
    • Error codes
    • Schema
      • Queries
      • Mutations
      • Objects
      • Interfaces
      • Scalars
      • Input objects
      • Enums
      • Unions
  • CHANGELOG
    • Changelog
    • Breaking changes
  • Guides
    • Authentication
    • Basic query tutorial
    • Batching mutations
    • Integrating data
  • Query examples
    • List of products with attributes and they values in product stream
    • Get information about specific product and specific attribute values in specific language
    • List of 100 grouped products with simple and variable products in stream
    • List of grouped products with simple and variable products AFTER some end cursor
    • List of active languages
    • List of templates with attributes
    • List of all multimedia in stream
    • List of product relations for a specific product
    • Get values of custom fields
    • Create a simple product
    • Create a grouping product
    • Create a variable product
    • Add a child product to grouping one
    • Set quantity of child product
    • Remove a child product from grouping one
    • Add a variant to variable product
    • Get products with variants, binding attributes and variants list
    • Remove a variant product from variable one
    • Multimedia create
    • Add images to the gallery attribute
    • Change the name of the multimedia
    • Set alternative value for a multimedia
    • Delete Multimedia
    • Add a file to the product
    • Get attributes list by SKU
    • Create a product and assign / modify attributes values
    • Assign the template to a product
    • Create a category
    • Get category tree by category tree code
    • Get a specific category with values of the category attribute
    • Set multiple options in multiselect attribute on specific product
  • Add option to select type attribute
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Query examples

Create a product and assign / modify attributes values

This mutation assumes that below already exists in the system:

  • template with code template

  • textarea attribute with code description

  • textarea attribute with code short_description

  • text attribute with code text

  • pl_PL language is active

Note that each mutation is aliased (create: (...)). Aliasing is required if there are at least two same mutations in one batch - productAddAttributeValueTranslationsTextarea in this case.

For simplicity, all mutations have been aliased in the example but it'd also suffice to only alias duplicates.

mutation {
  create: productCreateSimple(input: {sku: "new_product", templateCode: "template"}) {
    __typename
  }
  assignDescription: productAddAttributeValueTranslationsTextarea(
    input: {
      sku: "new_product"
      attributeCode: "description"
      translations: [{ value: "Długi opis", language: "pl_PL" }]
    }
  ) {
    __typename
  }
  assignShortDescription: productAddAttributeValueTranslationsTextarea(
    input: {
      sku: "new_product"
      attributeCode: "short_description"
      translations: [{ value: "Krótki opis", language: "pl_PL" }]
    }
  ) {
    __typename
  }
  assignText: productAddAttributeValueTranslationsText(
    input: {
      sku: "new_product"
      attributeCode: "text"
      translations: [{ value: "wartość", language: "pl_PL" }]
    }
  ) {
    __typename
  }
}
PreviousGet attributes list by SKUNextAssign the template to a product

Last updated 2 years ago

Was this helpful?