Create, update or delete a product
distru-mutate-productWriteCreates, updates or deletes one catalog product.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| action | enumCREATEUPDATEDELETE | Yes | |
| id | string | No | Required for UPDATE and DELETE. Resolve via distru-search-products. |
| name | string | No | Required for CREATE. Unique within your company. No : [ or ]. |
| sku | string | No | Required for CREATE. Unique within your company. |
| categoryId | string | No | Required for CREATE. Resolve via distru-search-lookups (type PRODUCT_CATEGORY). |
| unitTypeId | string | No | Required for CREATE. Package-tracked products need a standard unit type. Cannot change once the product has inventory. Resolve via distru-search-lookups (type UNIT_TYPE). |
| vendorId | string | No | Required for CREATE. Vendor company. Resolve via distru-search-companies. |
| unitPrice | string or number | No | Required for CREATE. Sale price per unit. |
| inventoryTrackingMethod | enumBATCHPACKAGEPRODUCT | No | Required for CREATE; cannot change afterwards. PACKAGE: stock in Metrc-tagged packages. BATCH: lot-tracked stock without Metrc tags. PRODUCT: untracked stock. |
| description | string or null | No | Plain text. Also sets descriptionMarkdown to it unless descriptionMarkdown is sent too. Required when your company requires product descriptions. Send null to clear it. |
| descriptionMarkdown | string or null | No | Supports italic, bold, strikethrough, links. Cleared only by description: null, which clears both. Send null to clear it. |
| externalName | string or null | No | Customer-facing name on Distru Commerce menus; blank falls back to name. Send null to clear it. |
| upc | string or null | No | Send null to clear it. |
| subcategoryId | string or null | No | Must belong to the product's category. Resolve via distru-search-lookups (type PRODUCT_CATEGORY, each row's subcategories). Send null to clear it. |
| brandId | string or null | No | Brand company. Resolve via distru-search-companies. Send null to clear it. |
| strainId | string or null | No | From the strain on distru-search-products rows. Send null to clear it. |
| groupId | string or null | No | Resolve via distru-search-lookups (type PRODUCT_GROUP). Send null to clear it. |
| ownerId | string or null | No | Owning user. Resolve via distru-search-users. Send null to clear it. |
| unitCost | string or number or null | No | Send null to clear it. |
| wholesaleUnitPrice | string or number or null | No | Send null to clear it. |
| msrp | string or number or null | No | Send null to clear it. |
| unitsPerCase | string or number or null | No | Greater than zero. Send null to clear it. |
| maxMenuBuyerOrderQuantity | integer or null | No | Most units of the product one buyer may put in one Distru Commerce menu order, on every menu; sales reps are exempt. null = no cap. Send null to clear it. |
| totalCannabinoidUnit | enum or nullMGPERCENT | No | Required while totalThc or totalCbd is set. Send null to clear it. |
| totalThc | string or number or null | No | In totalCannabinoidUnit; non-negative, at most 100 for PERCENT. Send null to clear it. |
| totalCbd | string or number or null | No | In totalCannabinoidUnit; non-negative, at most 100 for PERCENT. Send null to clear it. |
| quantityAvailableThresholdMin | string or number or null | No | Low-stock alert, in the product's unit type; below quantityAvailableThresholdMax. Send null to clear it. |
| quantityAvailableThresholdMax | string or number or null | No | High-stock alert, in the product's unit type; above quantityAvailableThresholdMin. Send null to clear it. |
| unitNetWeight | string or number or null | No | Per unit, in unitNetWeightAndServingSizeUnitTypeId, which must be set with it. Greater than zero. Send null to clear it. |
| unitServingSize | string or number or null | No | Per unit, in unitNetWeightAndServingSizeUnitTypeId, which must be set with it. Greater than zero, at most unitNetWeight. Send null to clear it. |
| unitNetWeightAndServingSizeUnitTypeId | string or null | No | Weight or volume unit type. Required while unitNetWeight or unitServingSize is set. Resolve via distru-search-lookups (type UNIT_TYPE). Send null to clear it. |
| grossWeight | string or number or null | No | Per unit, in grossWeightUnitTypeId; greater than zero. Set or clear together with it. Send null to clear it. |
| grossWeightUnitTypeId | string or null | No | Weight unit type Metrc supports; set or clear together with grossWeight. Resolve via distru-search-lookups (type UNIT_TYPE). Send null to clear it. |
| tagIds | string[] | No | Replaces the whole list; [] removes every tag. Resolve via distru-search-lookups (type PRODUCT_TAG). |
| isInactive | boolean | No | Hidden from distru-search-products unless its status asks for inactive. |
| isFeatured | boolean | No | Pinned to the top of Distru Commerce menus. |
| menuVisibility | enumDO_NOT_INCLUDEINCLUDE_IN_ALLINCLUDE_IN_SELECT | No | Distru Commerce menus. INCLUDE_IN_SELECT: the menus in menus; links to menus you can't see stay. INCLUDE_IN_ALL: every current menu, and new ones, except a copy of a menu it isn't on, or a new (not copied) menu made by someone who can't see the product. |
| menus | string[] | No | Required with menuVisibility INCLUDE_IN_SELECT and only read then. Replaces the whole list. Resolve via distru-search-menus. |
| customFields | object[] | No | Only the fields listed change. Required custom fields must be set, on update too, while still blank. |
| customFields[]. | string | Yes | Resolve via distru-search-custom-fields (entityType PRODUCT). |
| customFields[]. | string or string[] | Yes | TEXT: the text. DROPDOWN: the option name. CHECKBOX: an array of option names. DATE: YYYY-MM-DD, company timezone. "" or [] clears the field. |
Output
This tool returns one of 2 shapes, depending on its inputs.
Presence on a nested field assumes its parent exists.
Result with product
| Field | Type | Presence |
|---|---|---|
| product | object | Always |
| product. | string | Always |
| product. | object[] | Always |
| product. | object | Always |
| product. | string | Always |
| product. | string | Always |
| product. | enumCHECKBOXDATEDROPDOWNTEXT | Always |
| product. | string | Can be null |
| product. | string | Always |
| product. | string | Can be null |
| product. | string | Always |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | boolean | Always |
| product. | boolean | Always |
| product. | number | Can be null |
| product. | enumBATCHPACKAGEPRODUCT | Always |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Always |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | enumMGPERCENT | Can be null |
| product. | string | Always |
| product. | string | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | string | Can be null |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | string | Can be null |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | enumDO_NOT_INCLUDEINCLUDE_IN_ALLINCLUDE_IN_SELECT | Always |
| product. | object[] | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object | Always |
| product. | string | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object | Null or absent |
| product. | string | Always |
| product. | string | Null or absent |
| product. | object | Null or absent |
| product. | string | Always |
| product. | string | Null or absent |
| product. | object | Can be null |
| product. | string | Always |
| product. | object | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object | Can be null |
| product. | string | Always |
| product. | string | Always |
| product. | object[] | Always |
| product. | string | Always |
| product. | string | Always |
Result with id
| Field | Type | Presence |
|---|---|---|
| id | string | Always |
What the AI reads
Creates, updates or deletes one catalog product. Creates no inventory and pushes nothing to Metrc. Cannot add images, so CREATE is refused when your company requires product images. Does not change images, inventory, batches or the bill of materials (use distru-set-product-bill-of-materials); apply the same change to many products with distru-bulk-update-products. Read current values with distru-get-product. DELETE soft-deletes the product with its batches and bill of materials (no tool or screen restores them) and removes it from other products' bills of materials for good; refused while it has stock or appears on any sales order, purchase, return, stock transfer, product request or assembly; to retire such a product, UPDATE isInactive. CREATE and UPDATE return the product as distru-get-product does with includeTags; DELETE returns its id. Sparse update: on UPDATE only the fields passed change and the rest stay as they are; a field sent as null is cleared.