How to resolve pricing configuration given location id and company location id in GraphQL?

Hi Shopify team,

I’m working on integrating Markets logic into an app that generates custom sales orders. These orders may include product variants, custom products, discounts, and additional charges.

To display correct pricing, I rely on context that includes:

  • Customer’s country
  • Retail location ID
  • Company location ID (optional)

From what I understand, Shopify Markets configurations can reflect on Product and ProductVariant’s contextualPricing, and that’s working well.

However, I also need to determine the currencyCode for discounts and charges that are not associated with any products. This means I need to resolve the currency from the context, but without a product or product variant ID.

The recommended approach is to use marketsResolvedValues (as noted here). However, this only accepts country, while contextualPricing also supports locationId and companyLocationId.

Question:
How can I resolve the currencyCode using country + locationId + companyLocationId, without querying a product via contextualPricing?

I noticed that passing the same country to both contextualPricing and marketsResolvedValues can return different currencies.
e.g. in my dev store I have a market targeting a specific company location id with AFN currency configuration. But when I query:

query {
  marketsResolvedValues(buyerSignal: { countryCode: AF }) {
		currencyCode    
  }
  productVariants(first: 2) {
    nodes {
      contextualPricing(context:{ country: AF }) {
        price {
          amount
          currencyCode
        }
      }
    }
  }
}

I get:

{
  "data": {
    "marketsResolvedValues": {
      "currencyCode": "CAD"
    },
    "productVariants": {
      "nodes": [
        {
          "contextualPricing": {
            "price": {
              "amount": "506.42",
              "currencyCode": "AFN"
            }
          }
        },
        {
          "contextualPricing": {
            "price": {
              "amount": "1266.04",
              "currencyCode": "AFN"
            }
          }
        }
      ]
    }
  }
}

But I expected to get the same currency in both nodes. Is this correct?