> For the complete documentation index, see [llms.txt](https://docs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.akinon.com/technical-guides/project-zero/next.js/plugins/akinon-next/data-fetching/server/product.md).

# Product

## <mark style="color:red;">getProductData</mark> <a href="#getproductdata" id="getproductdata"></a>

This function is used to fetch product data and related breadcrumb data.

The **getProductData** function is imported from `'@akinon/next/data/server'`.

```javascript
import { getProductData } from '@akinon/next/data/server';
```

The product data is fetched by defining this function as follow:

```javascript
const {
      data: { product }
    } = await getProductData({
      pk
      searchParams,
      groupProduct: true
    });
```

* `pk`: The pk of the desired product to be fetched. This parameter is mandatory and should be of type Number.
* `searchParams`: An optional parameter that can be used to send additional data via query strings. It should be of type String.
* `groupProduct`: This parameter has a default value of `false`. When set to `true`, it fetches group product data. It should be of type Boolean.

Data returned from the function:

```json
{
    "in_stock": false,
    "product": {
        "pk": 2,
        "name": "Pink Polyester Tunic",
        "sku": "sp0001",
        "base_code": "Sample1",
        "attributes": {
            "filterable_size": "10",
            "integration_pack_color": "Pink",
            "color": "Pink",
            "gender": "woman",
            "size_switcher": "UK",
            "hexcolorcode": "#FF4081",
            "international_size": "34",
            "filterable_color": "Pink",
            "size": "10"
        },
        "attribute_set": 1,
        "attributes_kwargs": {
            "filterable_size": {
                "value": "10",
                "data_type": "dropdown",
                "label": "10"
            },
            "color": {
                "value": "Pink",
                "data_type": "dropdown",
                "label": "Pink"
            },
            "gender": {
                "value": "woman",
                "data_type": "dropdown",
                "label": "Woman"
            },
            "size_switcher": {
                "value": "UK",
                "data_type": "dropdown",
                "label": "UK"
            },
            "international_size": {
                "value": "34",
                "data_type": "dropdown",
                "label": "34"
            },
            "filterable_color": {
                "value": "Pink",
                "data_type": "dropdown",
                "label": "Pink"
            },
            "size": {
                "value": "10",
                "data_type": "dropdown",
                "label": "10"
            }
        },
        "extra_attributes": {},
        "productimage_set": [
            {
                "pk": 1,
                "status": "active",
                "image": "https://akn-randb.a-cdn.akinoncloud.com/products/2023/04/10/1/44709396-f2cc-4b21-968e-087acada415e.jpg",
                "order": 0,
                "created_date": "2023-04-10T17:27:02.525048Z",
                "specialimage_set": []
            },
            {
                "pk": 2,
                "status": "active",
                "image": "https://akn-randb.a-cdn.akinoncloud.com/products/2023/04/10/1/d38e0570-1c04-466d-a122-2242f86bdf71.jpg",
                "order": 1,
                "created_date": "2023-04-10T17:27:02.634909Z",
                "specialimage_set": []
            }
        ],
        "price": "32",
        "in_stock": false,
        "currency_type": "aed",
        "retail_price": "80",
        "unit_type": "qty",
        "absolute_url": "/women/pink-polyester-tunic-sample1-pink/p/",
        "productvideo_set": [],
        "product_type": "0",
        "price_type": "default",
        "form_schema": null,
        "is_ready_to_basket": false,
        "stock": 0,
        "data_source": null,
        "basket_offers": []
    },
    "variants": [],
    "selected_variant": null
}
```


---

# 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://docs.akinon.com/technical-guides/project-zero/next.js/plugins/akinon-next/data-fetching/server/product.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.
