Product
Attributes
Attributes are the qualities that define items. For instance, the attributes of a t-shirt include color, size and fabric, while a mobile phone’s attributes include camera resolution, screen brightness, memory, disk capacity, color. In short, attributes indicate to the qualities of a product.
- key: A code assigned for a given attribute.
- data_type: Data type contained by the given attribute. It can be text, email, text_area, date, datetime, boolean, valuelabel, dropdown, multiple, price, nested_object, image, file, model, or bundle.
- default_value: It indicates the default value set for this attribute. is_required: Designates whether this attribute can be empty when creating or editing the product.
- is_visible: Designates whether this attribute will show in the back-office panel.
- is_searchable: Designates whether the search function is active.
- is_filterable: Designates whether the attribute value can be filtered.
- is_variant: There will be a variant based on this value between child products linked to parent products, such as this parameter being True for "size" attribute. For example: Size X T-shirt, Size L T-shirt etc.
- is_variant_listable: Designates whether different variants of the same product will be shown in the product list page. name: Name assigned to this attribute.
- is_form_required: If this attribute is active when an item is added in the basket, the customer will fill in a form.
- is_form_field_required: Designates whether it is mandatory to fill in the form field.
Attribute Sets
Attribute sets are groups of attributes. Each product can belong to different attribute groups and these groups represent the qualities of the attribute group. For instance: Television, mobile phone, sneakers, t-shirt and couch have different attribute sets.
- name: Attribute Set name.
- attribute_set_type: Enum attribute that can be assigned as Simple or Group.
- attributeconfig_set: List of attributes included in the attribute set. The list comprises the attribute it's linked to, attribute_set and their additional attributes. In addition, an order field and the default_fields assigned as standard are listed.
- order: The order that represents Attribute Set.
- attribute_set: Represents the API key linked to the customer account.
Attribute Values
- attribute: Attribute ID associated with the attribute value.
- value: Attribute value.
- order: The order assigned for the attribute value.
- label: Attribute value label. It will be visible in backoffice.
Products
Product API is an endpoint that lists product information to return various content. Below example can be used to list all products. Likewise, when you send a request to view a product details page, you will see a similar content.
GET
Product List
Path : https://{commerce_url}/list/
- pagination: Returns information about the total number of products and pagination for the product list.
- facets: Contains the filters that can be used for the product list and the options that can be used for these filters. For filtering, the value of the option related to the ‘search_key’ parameter returned for each facet must be sent to the same endpoint with a GET request.
- sorters: Contains the sorting options used to arrange the product list. For sorting, the value of the selected sorter option against the sorter parameter must be sent to the same endpoint with a GET request.
- products: Contains a list of the relevant products.
Response
{
"in_stock": true,
"product": {
“pk”: 1106,
"name": "White T-shirt",
"sku": 2672881096038,
"base_code": "1KBORN0076",
"attributes": {},
"attribute_set": 68,
"attributes_kwargs": {...},
"extra_attributes": {...},
"productimage_set": [...],
"price": 24.94,
"in_stock": true,
"currency_type": "try",
"retail_price": 99.75,
"unit_type": "qty",
"absolute_url": "/white-tshirt/",
"productvideo_set": [],
"product_type": 0,
"price_type": "default",
"form_schema": null,
"is_ready_to_basket": false,
"stock": 5,
"data_source": null,
"basket_offers": [
{
"pk": 12,
"label": "Free Cargo",
"listing_kwargs": {},
"kwargs": {
"show_benefit_products": false
}
}]
},
"variants": [
{
"attribute_key": "color",
"attribute_name": "Color",
"options": [
{
"is_selected": true,
"is_selectable": true,
"is_selectable_without_stock": true,
"in_stock": true,
"order": 0,
"label": "WHITE",
"value": "WHITE",
"product": {...}
},
{
"is_selected": false,
"is_selectable": true,
"is_selectable_without_stock": true,
“in_stock”: true,
"order": 0,
"label": "BLUE/RED",
"value": "BLUE/RED",
"product": {...}
}
]
},
{
"attribute_key": "size",
"attribute_name": "Size",
"options": [
{
"is_selected": true,
"is_selectable": true,
"is_selectable_without_stock": true,
"in_stock": true,
"order": 0,
"label": "L-X",
"value": "L-X",
"product": {...}
}
]
}
],
"selected_variant": {...}
}
Product Detail
The endpoint used to obtain the details of the product.
Request GET
Path: https://{commerce_url}/product/<product_id>
- product: Returns information concerning the relevant product. Attributes contain the information entered when defining the product.
- variants: Returns the options and product information of different variants (color, size, etc.) for the relevant product. For instance, if the product is a t-shirt, different color/size options will be returned in this field.
- selected_variant: Returns the product information selected for the relevant product.
Response
{
"in_stock": true,
"product": {
“pk”: 1106,
"name": "White T-shirt",
"sku": 2672881096038,
"base_code": "1KBORN0076",
"attributes": {},
"attribute_set": 68,
"attributes_kwargs": {...},
"extra_attributes": {...},
"productimage_set": [...],
"price": 24.94,
"in_stock": true,
"currency_type": "try",
"retail_price": 99.75,
"unit_type": "qty",
"absolute_url": "/white-tshirt/",
"productvideo_set": [],
"product_type": 0,
"price_type": "default",
"form_schema": null,
"is_ready_to_basket": false,
"stock": 5,
"data_source": null,
"basket_offers": [
{
"pk": 12,
"label": "Free Cargo",
"listing_kwargs": {},
"kwargs": {
"show_benefit_products": false
}
}]
},
"variants": [
{
"attribute_key": "color",
"attribute_name": "Color",
"options": [
{
"is_selected": true,
"is_selectable": true,
"is_selectable_without_stock": true,
"in_stock": true,
"order": 0,
"label": "WHITE",
"value": "WHITE",
"product": {...}
},
{
"is_selected": false,
"is_selectable": true,
"is_selectable_without_stock": true,
“in_stock”: true,
"order": 0,
"label": "BLUE/RED",
"value": "BLUE/RED",
"product": {...}
}
]
},
{
"attribute_key": "size",
"attribute_name": "Size",
"options": [
{
"is_selected": true,
"is_selectable": true,
"is_selectable_without_stock": true,
"in_stock": true,
"order": 0,
"label": "L-X",
"value": "L-X",
"product": {...}
}
]
}
],
"selected_variant": {...}
}
- In addition to above fields, there are certain contents directly related to the product, which are:
Product Category
Indicates the category to which the product belongs.
Request GET
Path: product_category/
Response
- product: The product linked to the category type.
- category: Linked category key.
Product Images
The model that includes image content linked to the product. Contains fields such as product, image, order, height and width. It can be checked with the following requests.
- product: The product linked to the image file.
- image: Indicates the array linked to the image file.
- order: Indicates the viewing order in which the image file will be displayed.
- height: Height value of the image file.
- width: Width value of the image file.
Product Video
The model that includes video content linked to the product. It can be checked with the following requests.
- product: The product linked to the video file.
- image: Indicates the array linked to the video file.
- order: Indicates the viewing order in which the video file will be displayed.
Product Stock
The structure that contains stock information of the product. It lists fields such as product, stock, unit_type and extra_field.
- product: The product linked to the stock.
- stock: Indicates stock quantity in units.
- unit_type: Indicates stock unit type. Assigned as ‘qty’ by default.
- extra_field:
Product Price
This section includes information about product price. This field is used for all actions related to product price such as price, price type and tax rate. It includes fields such as price, currency_type, tax_rate, retail_price and extra_field.
- product: The product linked to the unit price.
- price: Indicates unit price.
- currency_type: Indicates currency.
- tax_rate: Indicates tax rate.
- retail_price: Indicates retail price.
- extra_field:
Product Collections
Request GET
Path: product_collections/
Response
- uuid: The product linked to the stock.
- name: Product Collections name
- slug: Address abbreviation derived from the name.
- is_active: Designates whether product collections are active or passive.
- sort_option: Indicates selected sorting option
Shipping Options
This section includes attributes in which shipping options information can be viewed.
- name: Name assigned to the Shipping Option
- slug: Address abbreviation derived from the name.
- is_active: Indicates whether shipping option is active or passive.
- calculator: Indicates calculated shipping cost.
- rule: Indicates if there are any rule types determined as shipping condition.
- sort_order:
- description:
Product Priority
- product: The product linked to the priority.
- priority: Priority status.
Extra Product Stock
If there is an extra stock belonging to the product, this structure indicates the link.
- product: The product linked to the extra product stock.
- stock: Indicates stock amount.
- unit_type: Indicates stock unit type. Assigned as ‘qty’ by default.
- stock_list: Indicates the ID of the stock list linked to the attribute.
- stock_list_detailed: Returns stock list details including list name and code.
Extra Product Price
This section indicates whether there is an extra price attribute assigned to the product.
- product: Product linked to the extra product price.
- price: Price field.
- currency_type: Indicates currency.
- tax_rate: Indicates tax rate.
- retail_price: Indicates retail price.
- price_list: Indicates the ID of the price list linked to the attribute.
- price_list_detailed: Returns price list details including list name and code.