For the complete documentation index, see llms.txt. This page is also available as Markdown.

Product Categories

Administrative endpoints for product–category links — the join records that file a product under one or more category nodes. Each record ties one product to one category node and optionally flags that link as the product's main category.

A product–category link is a thin association: a product reference, a category-node reference, and an is_main flag. The category nodes themselves are managed with the Category Nodes endpoints and the products with the Products endpoints; these endpoints only manage the links between them.

Core Capabilities

1. Link Listing & Filtering

  • Retrieve a paginated list of all product–category links.

  • Filter by id, product, or category to find the links for a given product or category node.

  • Order results with the sort parameter.

2. Link Lifecycle Management

  • Create a link that files a product under a category node.

  • Fully or partially update an existing link (for example, to move the is_main flag).

  • Delete a link (hard delete — the record is permanently removed).

Product–Category Fields

Field
Type
Description

pk

integer

The unique identifier of the link. Assigned by the server; read-only.

product

integer

The identifier of the linked product. Required on create and full update.

category

integer

The identifier of the linked category node. Required on create and full update.

is_main

boolean or null

Whether this is the product's main category. Optional; defaults to null (unset).

The pair (product, category) is unique — a product cannot be filed under the same category node twice. A duplicate is rejected with 400 Bad Request carrying a non_field_errors entry.

Filtering & Ordering

Parameter
Match
Notes

id

Exact

Filter by the link's own identifier.

product

Exact

Keep only links for the given product identifier.

category

Exact

Keep only links for the given category-node identifier.

Use the sort query parameter to order on pk, product, category, or is_main; prefix with - for descending (e.g. ?sort=-pk). No default ordering is applied.

Deletion Behavior

DELETE /product_category/{id}/ permanently removes the link record — there is no soft-delete or is_active flag on this resource. As a side effect, deleting a link refreshes the parent product's modified_date when that timestamp is older than 60 seconds, so downstream indexers pick up the change.

Dynamic Settings & Environment Variables

No dynamic settings (dj_dynamic_settings) and no environment variables affect these endpoints. The GROUPED_PRODUCT_PRICE_SELECTOR and LIST_SIMPLE_INSTEAD_OF_META settings registered in omnishop/catalogs/settings/conf.py are consumed only by the product price and stock services, not by the product–category links.

Last updated

Was this helpful?