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
}
}
Last updated
Was this helpful?