> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/products/group-product-items/update-a-group-product-item.md).

# Update a group product item

Updates a group product item. The change is applied only when a `to_product` is supplied; the new `to_product` must be a **Simple** product and must not already form a duplicate pair with the item's grouped product. On success the grouped product's price is recomputed using the `GROUPED_PRODUCT_PRICE_SELECTOR` dynamic setting. Business-rule violations return HTTP `406`.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Group Product Items","description":"Administrative endpoints for **group product items** — the membership rows that link a **Grouped** product (the `from_product`, sold as a set) to each **Simple** product it contains (the `to_product`), together with the quantity of that member included in the set.\n\n## Core Capabilities\n\n**1. Group Item Listing & Filtering**\n* Retrieve a paginated list of group product items.\n* Filter by the grouped master product (`from_product`) and by the member product (`to_product`).\n\n**2. Group Item Lifecycle Management**\n* Add a member to a grouped product, retrieve, update (PUT/PATCH), or remove one.\n* Whenever an item is created or updated, the grouped master product's price is recomputed from its members' prices (see the dynamic setting below).\n\n## Membership Rules\n\n| Rule | Description |\n|------|-------------|\n| Master type | `from_product` must be a **Grouped** product. Otherwise the request is rejected with `group_product_item_100_1`. |\n| Member type | `to_product` must be a **Simple** product. Otherwise the request is rejected with `group_product_item_100_2`. |\n| Uniqueness | A given `(from_product, to_product)` pair may exist only once. A duplicate is rejected with the \"already exists\" error. |\n\n## Dynamic Settings & Environment Variables\n\nThe behavior of the create and update operations is influenced by the following dynamic setting, configured in the management panel.\n\n| Key | Type | Default | Effect |\n|-----|------|---------|--------|\n| `GROUPED_PRODUCT_PRICE_SELECTOR` | string (one of three dotted import paths, chosen from a fixed list) | `omnishop.catalogs.selector.group_product_min_price_selector` (Minimum Price) | Selects the strategy used to derive a grouped product's price from its members' prices. It is applied on **create** (`POST /group_product_items/`) and **update** (`PUT`/`PATCH /group_product_items/{id}/`), when the grouped master product's price is recomputed after its membership changes. Allowed values are `...group_product_min_price_selector` (lowest member price), `...group_product_max_price_selector` (highest member price), and `...group_product_sum_price_selector` (sum of member prices). |\n\n**Environment variables:** No environment variables affect these endpoints."}],"servers":[{"description":"Omnitron Remote Proxy (external access — recommended)","url":"https://{omnitron_url}/api/v1/remote/{channel_id}","variables":{"omnitron_url":{"default":"sandbox.akinon.com","description":"Omnitron server URL (e.g., {omnitron.akinon.com})"},"channel_id":{"default":"1","description":"The channel identifier the remote request is routed through"}}},{"description":"Commerce API Server (internal / direct access only)","url":"https://{commerce_url}/api/v1","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Internal commerce server URL, reachable only from within the Omnitron network"}}}],"security":[{"tokenAuth":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token credential sent in the Authorization header, in the form: `Token <your-token>`. Requires a staff (admin) account."}},"schemas":{"GroupProductItemRequest":{"type":"object","description":"Fields for creating or fully replacing a group product item. `from_product` must be a Grouped product and `to_product` a Simple product; the pair must be unique.","required":["from_product","to_product","initial_quantity"],"properties":{"from_product":{"type":"integer","description":"Identifier of the grouped master product."},"to_product":{"type":"integer","description":"Identifier of the member (simple) product."},"order":{"type":"integer","minimum":0,"description":"Sort order of the member within the group. Defaults to `0`.","default":0},"initial_quantity":{"type":"integer","minimum":0,"description":"Quantity of the member product included in the set.","default":1}}},"GroupProductItem":{"type":"object","description":"A membership row linking a grouped product to one of its member (simple) products.","properties":{"pk":{"type":"integer","readOnly":true,"description":"Unique identifier of the group product item."},"from_product":{"type":"integer","description":"Identifier of the grouped master product."},"to_product":{"type":"integer","description":"Identifier of the member (simple) product."},"order":{"type":"integer","minimum":0,"description":"Sort order of the member within the group. Lower values appear first.","default":0},"initial_quantity":{"type":"integer","minimum":0,"description":"Quantity of the member product included in the set.","default":1}},"required":["pk","from_product","to_product","order","initial_quantity"]},"ValidationError":{"type":"object","description":"Returned when the request contains invalid or missing data. Errors are grouped by the field they apply to: each key is the name of a field from the request and its value is a list of one or more messages describing what is wrong with that field. Messages that do not belong to any single field are grouped under `non_field_errors`.","properties":{"non_field_errors":{"type":"array","description":"Error messages that apply to the request as a whole rather than to a specific field.","items":{"type":"string"}}},"additionalProperties":{"type":"array","description":"The list of error messages for the field named by the key.","items":{"type":"string"}}},"Error":{"type":"object","description":"An error response.","properties":{"detail":{"type":"string","description":"A human-readable description of the error."}},"additionalProperties":true},"GroupProductItemBusinessError":{"type":"object","description":"Returned with HTTP `406` when a group product item request violates a membership rule.\n\n| `error_code` | Meaning |\n|--------------|---------|\n| `group_product_item_100_1` | `from_product` is not a Grouped product. |\n| `group_product_item_100_2` | `to_product` is not a Simple product. |\n| `group_product_item_100_1` | The `(from_product, to_product)` pair already exists. |","properties":{"non_field_errors":{"type":"string","description":"A human-readable message describing the membership rule that was violated."},"error_code":{"type":"string","description":"A stable code identifying the violation."}},"additionalProperties":true}},"responses":{"ValidationError":{"description":"The request contains invalid or missing data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"Unauthorized":{"description":"Authentication credentials were not provided or are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The authenticated user does not have administrator privileges.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"GroupProductItemNotFound":{"description":"The requested group product item does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"GroupProductItemBusinessError":{"description":"The request is well-formed but violates a membership rule — the master is not a Grouped product (`group_product_item_100_1`), the member is not a Simple product (`group_product_item_100_2`), or the `(from_product, to_product)` pair already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupProductItemBusinessError"}}}}}},"paths":{"/group_product_items/{id}/":{"put":{"tags":["Group Product Items"],"operationId":"updateGroupProductItem","summary":"Update a group product item","description":"Updates a group product item. The change is applied only when a `to_product` is supplied; the new `to_product` must be a **Simple** product and must not already form a duplicate pair with the item's grouped product. On success the grouped product's price is recomputed using the `GROUPED_PRODUCT_PRICE_SELECTOR` dynamic setting. Business-rule violations return HTTP `406`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupProductItemRequest"}}}},"responses":{"200":{"description":"The updated group product item.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupProductItem"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/GroupProductItemNotFound"},"406":{"$ref":"#/components/responses/GroupProductItemBusinessError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/products/group-product-items/update-a-group-product-item.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
