addProductUOM
Requires permission products:product:update.
Add a unit (pack) to a product or to one of its variants. The same unit cannot be added twice to the same product or variant. Only the product's own base unit can be marked base, and a variant can have at most 3 sellable units. Needs the products update permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AddProductUOM($data: CreateProductUOMInput!) {
addProductUOM(data: $data) {
id
createdAt
barcode
conversionFactor
deletedAt
deletedBy
uom {
id
code
colorCode
name
pluralName
createdAt
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AddProductUOM($data: CreateProductUOMInput!) {\n addProductUOM(data: $data) {\n id\n createdAt\n barcode\n conversionFactor\n deletedAt\n deletedBy\n uom {\n id\n code\n colorCode\n name\n pluralName\n createdAt\n }\n }\n}",
"variables": {
"data": {
"conversionFactor": 0,
"isBase": true,
"isInventory": true,
"isPurchase": true,
"isSales": true,
"minOrderQty": 0,
"orderMultiple": 0,
"productId": "string",
"uomId": "string"
}
}
}
EOF
Variables:
{
"data": {
"conversionFactor": 0,
"isBase": true,
"isInventory": true,
"isPurchase": true,
"isSales": true,
"minOrderQty": 0,
"orderMultiple": 0,
"productId": "string",
"uomId": "string"
}
}
Response:
{
"data": {
"addProductUOM": {
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"barcode": "string",
"conversionFactor": 0,
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string",
"uom": {
"id": "id",
"code": "string",
"colorCode": "string",
"name": "string",
"pluralName": "string",
"createdAt": "2025-01-15T00:00:00Z"
}
}
}
}
addProductUOM(
data: CreateProductUOMInput!
): ProductUOM!
Arguments
addProductUOM.data ● CreateProductUOMInput! non-null input
The product unit (pack) to add.
Type
ProductUOM object
A unit (pack) set up on a product or variant: its conversion factor to the base unit, the documents it can be used on, and its ordering and pricing rules.