# Fetching Prices from API directly to show in frontend causes performance problem in b2b site

**URL:** <https://forum.litium.com/t/fetching-prices-from-api-directly-to-show-in-frontend-causes-performance-problem-in-b2b-site/2946>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [May 11, 2023, 11:48am UTC](https://forum.litium.com/t/fetching-prices-from-api-directly-to-show-in-frontend-causes-performance-problem-in-b2b-site/2946 "2023-05-11T11:48:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [May 11, 2023, 11:48am UTC](https://forum.litium.com/t/fetching-prices-from-api-directly-to-show-in-frontend-causes-performance-problem-in-b2b-site/2946/1 "2023-05-11T11:48:58Z")

</div>

We have a requirement to fetch prices directly from api for b2b site. But calling method to fetch price from api for a every variant to be listed on product listing page is affecting the performance of the page.

We have an api in jeeves that fetches prices of different variants based on the variant ids we provide.

I know the pricecalculatordecorator is being called for each variant.

Can you suggest the best way to use pricing from api for the variants displayed on b2b frontend.

Litium version: _[7.6.0]_

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [May 11, 2023, 6:32pm UTC](https://forum.litium.com/t/fetching-prices-from-api-directly-to-show-in-frontend-causes-performance-problem-in-b2b-site/2946/2 "2023-05-11T18:32:41Z")

</div>

You can send in an array of

```auto
var calculatorItemArgs = new PriceCalculatorItemArgs
{
     VariantSystemId = variantSystemId,
      Quantity = decimal.One
 };

```

to

```auto
var prices = _priceCalculator.GetListPrices(calculatorArgs, calculatorItemArgsArray)

```

And then you get back multiple prices that you can collect and send back.

```auto
prices.TryGetValue(variantSystemId, out var price) // Save values here in an array and send back.

```

Then you only call PriceCalculator once, and you only need 1 call from Jeeves.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [June 8, 2023, 6:33pm UTC](https://forum.litium.com/t/fetching-prices-from-api-directly-to-show-in-frontend-causes-performance-problem-in-b2b-site/2946/3 "2023-06-08T18:33:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
