Product Collection Widgets
Administrative endpoints for product collection widgets — CMS widgets that render a list of products from a product collection on the storefront. A product collection widget combines the fields of a regular CMS widget (name, slug, template, widget type, and attributes defined by the widget type's schema) with a product collection, the maximum number of products to show, and the strategy used to pick which variant represents each product.
Storefront templates render a widget by its slug. When rendered, the widget searches the products of its collection, applies the collection's sort option, takes at most product_limit products, and passes them to the template together with the widget's attributes.
Core Capabilities
1. Listing & Filtering
Retrieve a paginated list of product collection widgets.
Filter by name, slug, template, widget type, product collection, product limit, extraction strategy, or creation or modification date.
Order results with the
sortparameter.
2. Widget Lifecycle Management
Create a widget; the slug is generated from the name when it is not sent.
Retrieve, fully or partially update, or permanently delete a widget.
3. Detailed Representation
GET /product_collection_widgets/detailed/andGET /product_collection_widgets/{id}/detailed/return the same records with the product collection expanded into a nested object instead of its identifier.
Product Collection Widget Fields
pk
integer
The unique identifier of the widget. Read-only.
name
string (max 255)
The display name of the widget. Required on create and full update.
slug
string (max 255)
The identifier storefront templates use to render the widget. Optional; when it is not sent on create, it is generated from name. Unique across all CMS widgets, not only product collection widgets.
template
string (max 512)
The path of the template that renders the widget. Required on create and full update.
widget_type
integer
The identifier of the widget type whose schema defines the accepted attributes. Required on create and on every update, including partial updates.
attributes
object
The attribute values of the widget, keyed by the entries of the widget type's schema. Required on create and on every update, including partial updates (see Attributes).
attributes_kwargs
object
Read-only supplementary detail the server derives for the stored attributes — for example the value and data type of a dropdown entry; plain text entries have no supplementary detail. It is returned in responses and ignored if sent. The detailed representation returns it in its stored form, which may carry additional internal keys such as _translations.
product_collection
integer
The identifier of the product collection whose products the widget shows. Required on create and full update. Expanded into a nested object in the detailed representation.
product_limit
integer
The maximum number of products the widget shows. Must be at least 1. Defaults to 10.
extraction_strategy
string or null
Which variant represents each product in the widget (see Extraction Strategies). Defaults to null.
created_date
string (date-time)
Read-only. When the widget was created.
modified_date
string (date-time)
Read-only. When the widget was last modified.
Attributes
The keys accepted in attributes come from the schema of the widget's widget type (managed through the widget_types endpoints).
attributesis required on create, full update and partial update — send an empty object ({}) if there are no values to set.Every key must exist in the widget type's schema. An unknown key is rejected with
400.Each value is validated against its schema entry — for example a dropdown value must be one of the entry's choices, and a multi-value entry must be sent as a list. A value that does not satisfy its entry is rejected with
406and theattribute_input_type_100code.Required flags in the schema are not enforced — an empty object is accepted even when the schema marks entries as required.
Entries that the schema marks as localizable are stored per language: they are written to, and returned in, the language active for the request, falling back to the default language where a translation is missing.
The stored attributes are replaced, not merged — the object sent replaces the non-localizable attributes and the localizable attributes of the request's language. Localizable values stored for other languages are kept. See
IGNORE_ACCEPT_LANGUAGE_HEADERunder Dynamic Settings & Environment Variables.
Extraction Strategies
extraction_strategy is accepted either by its name or by its value, and is always returned by its value. null means the default strategy is used.
default
omnishop.search.strategies.DefaultProductExtractionStrategy
Default.
first_item
omnishop.search.strategies.FirstItemSearchExtractionStrategy
First Variant.
listable_first
omnishop.search.strategies.ListableFirstProductExtractionStrategy
Listable Variant First.
min_price_first
omnishop.search.strategies.MinPriceFirstProductExtractionStrategy
Min Price Variant First.
max_price_first
omnishop.search.strategies.MaxPriceFirstProductExtractionStrategy
Max Price Variant First.
all_sub_products
omnishop.search.strategies.AllSubProductsExtractionStrategy
All Sub Products.
offer_product
omnishop.search.strategies.OfferProductExtractionStrategy
Offer Product.
product_sorting_item
omnishop.search.strategies.ProductSortingItemExtractionStrategy
Product Sorting Item.
Slug Handling
When
slugis sent and another CMS widget (of any kind) already uses it, the request is rejected with400on theslugfield.When
slugis not sent on create, it is generated fromname(for exampleSummer Picks→summer-picks). If the generated slug already belongs to another product collection widget, the request is rejected with406and thecms_product_collection_widget_100code. The generated slug must also not belong to a regular CMS widget — send an explicit, unusedslugin that case.On update, leaving
slugout keeps the current slug; it is never regenerated from a newname.
Partial Updates
Important: a partial update (
PATCH) requires bothwidget_typeandattributes— the attribute keys are always validated against the widget type sent in the same request. Send the current values when they are not meant to change.
Deleting a Widget
DELETE /product_collection_widgets/{id}/ is a hard delete — the widget is permanently removed. A widget still used by a data source landing page is protected and cannot be deleted; the request is rejected with 406. Detach it from the landing page first.
Filtering & Ordering
name
Case-insensitive partial match on the name.
slug
Case-insensitive partial match on the slug.
slug__in
A comma-separated list of slugs — keeps the widgets whose slug is exactly one of them.
template
Case-insensitive partial match on the template path.
widget_type
The identifier of a widget type. An identifier that does not exist is rejected with 400.
product_collection
The identifier of a product collection. An identifier that does not exist is rejected with 400.
product_limit
Exact match on the product limit.
extraction_strategy
Case-insensitive partial match on the stored strategy value (for example FirstItem); strategy names such as first_item do not match. Send NULL_VALUE to return only widgets without a strategy, or NOT_NULL_VALUE to return only widgets that have one.
created_date, modified_date
Exact match on a full ISO 8601 date-time. A date without a time is rejected with 400.
No default ordering is applied; use the sort parameter to order the results by any field, prefixing it with a hyphen for descending order.
Storefront Caching
When storefront templates render a widget by its slug, the rendered content is cached for a short time, so a change made through these endpoints may not appear on the storefront immediately.
Error Codes
Requests that are well-formed but conflict with a business rule are answered with 406 Not Acceptable and carry one of the following codes.
cms_product_collection_widget_100
The slug generated from name already belongs to another product collection widget.
attribute_input_type_100
An attribute value does not satisfy its schema entry (for example a dropdown value outside its choices, or a single value sent for a multi-value entry).
A delete rejected because the widget is still used by a data source landing page is also answered with 406; that response carries only non_field_errors, without an error_code.
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.
IGNORE_ACCEPT_LANGUAGE_HEADER
boolean
true
Whether the Accept-Language header is discarded before the request is processed. Affects create, update and partial update (the language localizable attributes are written to) and every read operation (the language localizable attributes are returned in). While it is true (the default), the header is honored only when the request also carries an X-Omnitron-Session header; otherwise it is removed and a plain API request falls back to the server's default language (LANGUAGE_CODE). For example, a create sent with Accept-Language: en-us but without X-Omnitron-Session stores its localizable values under the default language, not under en-us.
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 cms.ProductCollectionWidget and cms.Widget are added to this list, deleting a widget also records two deleted-item entries (one per model, because a product collection widget is stored as a widget plus its product collection extension), which are exposed through the data-warehouse deleted-items endpoint. Listing only one of the two labels suppresses only that model's entry. The API response is identical either way.
Environment variables and server settings
LANGUAGE_CODE
tr-tr
The server's default language. Localizable attributes are written to and returned in this language whenever the request language is not resolved to something else — see IGNORE_ACCEPT_LANGUAGE_HEADER above.
Last updated
Was this helpful?

