Order/market matching : discrepancy between order's country label and market's country label

Hi,

In the GraphQL admin API, there is currently no strong link between an order and the market is was placed through (please correct me if I missed something there). So the way we have to identify which market the order was placed through is to first extract the country name of the shipping address :

And have another direct query on the markets to check which one this country belongs to :

This could be fine if the label of the regions/countries were consistent between the order’s shipping address and the markets’ region name. However, for some cases the label is different :

This has forced us to build a list of label exceptions, that we can only react to when they trigger an error in our workflows :

Those are all the differences we have encountered so far. Going forward, it would be nice to :

  • either have direct access to the market on the Order object
  • or have the country codes returned by the market configuration
  • or have consistent country labels between the order and the market

P.S. : I am aware the the query marketByGeography exists ; this is however very suboptimal as it would force us to perform a query for each different country encountered in our workflows, without hard caching between each execution, as our markets configuration can move pretty often.
Also, some form of persistence on the order would be nice, to know which market the order belonged to at the time it was placed, even if its respective country moved between markets since.

Tell me what you think !

Just a follow-up as I can’t edit my post : the query marketByGeography is also deprecated as of now, which is probably a stronger argument than optimization issues.

Hey @Alex-OddBrew, instead of matching on country name strings, which aren’t consistent (as you’ve noted) I would recommend instead to use the CountryCode enum since ISO codes are standardized across the API.

On orders, shippingAddress.countryCodeV2 should reflect the market the customer checked out through. On the market side, the markets query returns region codes when you fragment on MarketRegionCountry, so you can build an accurate country code to market map.

Also, while there isn’t currently a market specific field, orders do carry some of that context. For example, presentmentCurrencyCode in money field and customerLocale for language used, if you need additional context beyond the country code.

Damn, such a long post for a lack of more thorough reading of the docs. Missed the MarketRegionCountry fragmenting. Thanks Kyle !