Product

useGetProductByPkQuery

This function is used to fetch product data.

The useGetProductByPkQuery function is imported from '@akinon/next/data/client/product'.

import { useGetProductByPkQuery } from '@akinon/next/data/client/product';

To use this function, the product's primary key (pk) needs to be provided as an argument:

const { data, isLoading, isSuccess } = useGetProductByPkQuery(
    item.product.pk
  );

The returned data can be used as data.product.in_stock.

Data returned from the function:

{
  "in_stock": true,
  "product": {
    "pk": 154,
    "name": "Product Name",
    "sku": "AKN-002-starprint001-XS",
    "base_code": "AKN-002",
    "attributes": {
      ...
    },
    "attribute_set": 6,
    "attributes_kwargs": {
      ...
    },
    "extra_attributes": {},
    "productimage_set": [{
      "pk": 201,
      "status": "active",
      "image": "https://img-url.jpg",
      "order": 0,
      "created_date": "2022-12-30T07:43:17.590001Z",
      "specialimage_set": []
    }],
    "price": "29.99",
    "in_stock": true,
    "currency_type": "eur",
    "retail_price": "29.99",
    "unit_type": "qty",
    "absolute_url": "/product-url/",
    "productvideo_set": [],
    "product_type": "0",
    "price_type": "default",
    "form_schema": null,
    "is_ready_to_basket": false,
    "stock": 968,
    "data_source": null,
    "basket_offers": []
  },
  "variants": [{
    ...
  }],
  "selected_variant": null
}

useGetInstallmentsQuery

This function is used to fetch installment payment information available in banks for a product's purchase.

The useGetInstallmentsQuery function is imported from '@akinon/next/data/client/product'.

To use this function, the productPk needs to be provided as an argument:

Data returned from the function:

useGetProductByParamsQuery

This function is used to fetch product and variants information, selected_variant, and in_stock status without navigating to the product details page.

The useGetProductByParamsQuery function is imported from '@akinon/next/data/client/product'.

To use this function, the productPk needs to be provided as an argument:

Data returned from the function:

useGetBundleProductDataQuery

The useGetBundleProductDataQuery function is used to fetch detailed data for a specific bundle product.

The useGetBundleProductDataQuery function is imported from '@akinon/next/data/client/product'.

This function can be used like this:

Last updated

Was this helpful?