> 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/bundle-chapter-products.md).

# Bundle Chapter Products

Administrative endpoints for **bundle chapter products** — the association records that define which miscellaneous products (`product_type` `4`) a customer can choose from inside a single chapter of a **Bundle** product. Each record links exactly one **bundle chapter** to exactly one **product**; together, the records of a chapter form its set of selectable options. See the **Bundle Chapters** section for the chapters themselves and the **Products** section for the shared product-type table.

### Core Capabilities

**1. Association Listing & Filtering**

* Retrieve a paginated list of chapter–product associations, each expanded with the full bundle chapter and the full product record.
* Filter by chapter or by product, negate either filter, and order the results with `sort`.
* The same data is also reachable under the `/detailed/` aliases (`/bundle_chapter_products/detailed/` and `/bundle_chapter_products/{id}/detailed/`), which return exactly the same payloads as the plain list and retrieve operations.

**2. Association Lifecycle Management**

* Add a miscellaneous product to a chapter's selectable options.
* Repoint an existing association at a different chapter or product.
* Remove an association, taking the product out of the chapter's options.

### Payload Shapes

This resource returns two different representations, selected by the operation. Plan client code accordingly — the object returned by **create** is not shaped like the object returned by **retrieve**.

| Operation                                                      | Representation                                                                                   |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| list, retrieve, `/detailed/` aliases, partial update (`PATCH`) | **Expanded** — `bundle_chapter` and `product` are full nested objects.                           |
| create (`POST`), update (`PUT`)                                | **Flat** — `bundle_chapter` and `product` are identifiers, in both the request and the response. |

Because every row of the expanded representation carries a complete product and a complete chapter (including their attribute data and images), listing is comparatively expensive. Filter by `bundle_chapter` and keep `limit` modest rather than paging through the unfiltered list.

### Filtering & Ordering

| Query parameter   | Effect                                                         |
| ----------------- | -------------------------------------------------------------- |
| `bundle_chapter`  | Keeps only the associations of the given chapter.              |
| `product`         | Keeps only the associations of the given product.              |
| `bundle_chapter!` | Negated form — excludes the associations of the given chapter. |
| `product!`        | Negated form — excludes the associations of the given product. |

Any other query parameter is ignored; related lookups such as `product__sku` are not supported. A non-numeric value for any of the four is rejected with a `400` validation error.

The stored records carry no ordering of their own, so results are returned **ordered by `id` ascending** by default. `sort` accepts only `pk`, `bundle_chapter`, and `product`, each optionally prefixed with `-` for descending order; ordering by `bundle_chapter` or `product` sorts by the related record's identifier. **Any other value — including `id`, `created_date`, and `modified_date` — is silently ignored** and the default ordering applies, so a client cannot tell an unsupported sort key from a supported one by the response alone.

### Validation Rules

* `product` must reference a product whose `product_type` is **Miscellaneous** (`4`). Any other product type (or a non-existent id) is rejected as an invalid identifier — a standard `400` validation error, not a business-rule error.
* `bundle_chapter` must reference an existing chapter; a bad id is likewise a `400` validation error.
* The combination of `bundle_chapter` and `product` must be **unique**. Adding a product that is already among the chapter's options fails with a `400` validation error rather than silently returning the existing association, so create is not idempotent.
* **`PATCH` cannot change an association — use `PUT`.** Partial update is served by the expanded representation, in which `bundle_chapter` and `product` are nested objects rather than identifiers. Sending either as an id fails validation with `400`; sending either as an object passes validation but is not supported by the endpoint and fails as a server error. Only an empty body (`{}`) succeeds, and it leaves the record unchanged.
* **Deleting an association is not blocked when the product is the chapter's `default_product`.** The record is removed and the chapter keeps pointing at a default product that is no longer among its selectable options. Verify the chapter's `default_product` before deleting, and update the chapter first if needed.
* Deletion is a **hard delete** — the association row is removed from the database. The product and the chapter themselves are untouched.

### Dynamic Settings & Environment Variables

No dynamic setting changes the request or response schema of these endpoints, but the two below affect their behavior. Each is referenced again in the description of the operations it affects.

| Key                             | Type             | Default                                                                                                                         | Effect                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `IGNORE_ACCEPT_LANGUAGE_HEADER` | boolean          | `true`                                                                                                                          | Whether the `Accept-Language` header is discarded before the request is processed. Affects every operation that returns the **expanded** representation (**list**, **retrieve**, the `/detailed/` aliases, **partial update**): the nested chapter and product are translated records, so this setting decides whether their translated fields follow `Accept-Language` or the server's default language. While it is `true` (the default), the header is honored only when the request also carries an `X-Omnitron-Session` header. |
| `IGNORE_DELETED_ITEMS_SIGNAL`   | array of strings | `["django_audit_events.AuditEvent", "django_audit_events.ArchivedAuditEvent", "sessions.Session", "datawarehouse.DeletedItem"]` | The model labels excluded from delete tracking. Affects **delete**: unless `products.BundleChapterProduct` is added to this list, removing an association also records a tombstone entry that the data-warehouse export consumes. The API response is identical either way; only the downstream export is affected.                                                                                                                                                                                                                  |

**Environment variables and server settings**

| Setting         | Default | Effect                                                                                                                                                                                                                                                                              |
| --------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LANGUAGE_CODE` | `tr-tr` | The server's default language. Applied to the translated fields of the nested chapter and product (names, attribute labels) and to the nested product's `absolute_url` whenever the request language is not resolved to something else — see `IGNORE_ACCEPT_LANGUAGE_HEADER` above. |
| `CDN_DOMAIN`    | —       | Set only where object storage is configured. It determines the form of the image URLs inside the nested product (`productimage_set`, image-valued attributes): absolute URLs on this domain when object storage is in use, relative `/media/...` paths otherwise.                   |


---

# 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/bundle-chapter-products.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.
