How should an app attribute orders to overlapping Markets for market-specific collection sorting?

Hi everyone,

We have an app that sorts products within collections using merchant-defined strategies. We want to support different sorting strategies for different markets.

For example, the same collection could use one strategy for Market A and another for Market B. Strategies can use revenue, price, or inventory. For revenue-based sorting, we want to rank products using sales relevant to the market being targeted, rather than store-wide sales.

My main question is how to determine the market attribution of an order when markets overlap.

The Markets inheritance documentation gives this example:

Market A includes Canada and the US.

Market B includes Canada and Mexico.

No parentage is inferred between them.

A Canadian buyer matches both markets. I was considering mapping an order’s country code to a market, but that doesn’t uniquely identify a market in this example.

I understand that multiple matching markets can contribute settings to one shopping experience. What I need to establish is whether Shopify exposes a market attribution on historical orders that apps can use for this purpose.

Is there a supported API field or reporting resource for this attribution? If Shopify does not assign one exclusive market to each order, what is the recommended approach for calculating market-specific product revenue without double-counting sales?

As a related question, if these overlapping markets have different storefront URLs, how is the customer’s URL selected? Does that selection have any relationship to sales attribution?

I’ve reviewed the alphabetical domain-selection rule for submarkets with multiple parent markets, but I’m looking for guidance specifically about overlapping peer markets.

Relevant example:

shopify.dev/docs/apps/build/markets/market-inheritance

Any documentation or guidance on the supported data model would be appreciated. Thank you!

Yeah so you kind of can, so you’ll need to use the Shopifyql: Schemas

Here you can for instance use customers and then use customer location. Check finance and also sales / orders for my schema references to use.

Thats how i would do it but defiantly can achieve this.

Thanks, @Tom_Hooker , appreciate the suggestion.

I’d prefer to avoid requesting additional customer-data access solely to calculate market-level product revenue. More importantly, customer location wouldn’t resolve the overlapping-market ambiguity.

In the documented example, Market A contains Canada + US and Market B contains Canada + Mexico, with no parentage inferred. Even if we know the customer is in Canada, that still matches both markets.

Does ShopifyQL expose an order’s attributed market, rather than just customer location? If not, is there a recommended way to allocate revenue between overlapping markets without counting the same sale twice?