How to get a list of fixed prices per query/category

Hello, when getting fixed prices we have encountered a few things:

  • Main request from our client is to be able to display fixed pricing per 25/125/250/etc items as a table (as per image attached)

  • In order to do that we need a list of fixed priced per search query or category

  • If we call https://api.vtex.com/{accountName}/pricing/prices//fixed/ without providing itemId, we get a list of all items, but it’s a 50/50 chance that the call will time out, and if it works, it takes 7+ seconds.

  • If we provide itemId it takes 72ms to get the request back, but that could mean that we are making 40-50 requests per page per each itemId. Is this solution fine with you? Or you have some other way to get a list of FIxed prices that’s more performant?

Thank you
@tyler

1 Like

Hey @ramansel, welcome to VTEX Community!

The way you are fetching fixed prices in bulk is the recommended way, but performance will degrade if you have many price tables or SKUs – as it appears to be the case there.

Depending on your application, you might be able to mitigate that effect through caching, pre-fetching or even generating a static versions of those tables (if prices don’t change too often).

For instance, you could have a service that fetches fixed prices using the Pricing API and stores them using the Master Data V2 API every so often, in the exact way you need them to be displayed.

Side note: Not sure if I understood correctly, but looks like you are using different price tables for bulk pricing, correct? So 25 is one price table, 50 is another price table, etc.

If so, that is understandable, but it’s not how price tables were meant to be used… Usually we expect only one price table to be used per sales channel and/or customer. That’s why our APIs aren’t structured in a way that is super performant for the way you are using it.