[QUESTION] How to retrieve Market and B2B prices optimally?

I am facing an issue with retrieving product prices using ProductVariant.contextualPricing. The problem arises when a customer’s store uses Market as “international” (covering more than 100 countries) with local currency mode, and they have also set up 15 company locations with price configurations, including both fixed prices and adjustment prices.

According to Shopify’s documentation, I found that ProductVariant.contextualPricing can help retrieve the price of a ProductVariant. However, the challenge is that, in addition to fetching prices for 100 countries and 15 company locations, I also need to retrieve all possible combinations of these 100 countries and 15 company locations to serve B2B customers using the Market feature.

This makes price retrieval extremely slow because a large number of requests need to be sent, especially if a customer’s store has more than 1,000 products.

If anyone understands this issue, could you provide me with suggestions or best practices for this situation? Thank you!

Heya! Curious for the use case behind this?

Are you looking to store all products in your app for each different countries? If so, product feeds may be a better option.

If you’re looking to build a custom storefront, then I suggest the storefront API with the @inContext directive

We are building an application that allows users to search and filter products. However, before that, we need to retrieve all product data to index them. Currently, fetching product prices is quite straightforward, but when combined with B2B, the number of requests to Shopify’s server will increase, making the process slower.

For example, in the scenario I mentioned earlier:
*“The problem arises when a customer’s store uses Market as ‘international’ (covering more than 100 countries) with local currency mode, and they have also set up 15 company locations with price configurations, including both fixed prices and adjustment prices.” And since we are currently using ProductVariant.contextualPricing to retrieve product prices based on variants, I would really like to know if there is a more optimized way to do this.