`market` Liquid variable doesn't give the correct ID when it's a B2B company location based market

Short description of issue

market Liquid variable doesn’t give the correct ID when it’s a B2B company location based market

Link to Shopify Store

Reproduction steps

  • I have created a new market called Company that includes the Snowdevil company location (this is all default test data on a test store).
  • I have implemented a market based customisation on the theme where the menu links are below the title instead of on the side
  • When I access the website logged in as a B2B customer in an appropriate location that is part of the market, I can see that the customisation is applied. Therefore the theme knows that I am in the company location based market but the liquid variable still gives me the marketId of the geographical location I am in.

Additional info

The market ID not being the company location based one means that we are unable to provide our customers with functionality where they can customise our product based on the market because the fact that we’re in the company location market is not being passed down to us.

What type of topic is this

Bug report

Upload screenshot(s) of issue



Hi @kartik-stoq

Shopify’s Liquid “market” context in themes is driven by geographic markets (country/language/domain), not by B2B company‑location markets, even when a company‑location market is what actually controls catalogs and pricing. So for a logged‑in B2B buyer, localization.market.id (or similar) will still give you the ID of the geo market they’re in, not the ID of the company‑location market that’s applied behind the scenes.

For B2B behavior in themes, Shopify exposes different signals: customer.b2b? (to know the buyer is B2B), plus customer.current_company and customer.current_location, where current_location is a company_location Liquid object. The reliable way to do “market‑like” customization for B2B is to key your logic off customer.current_location (its id, name, or metafields) rather than off market.id. A common pattern is to attach metafields to each company location (for example, metafields.theme.header_layout = "menu_below_title"), and then have the theme read those metafields to decide which layout or behavior to apply.

1 Like

Okay makes sense. Adding metafields to company_location will work. I can add a market_id metafield to it and use it to replace the one coming from the localisation.

Glad to hear this approach will work for you @kartik-stoq