shopifyqlQuery API returns “Metafield Column Not Found” for product metafield that works in Admin Analytics (same query)

ShopifyQL query (sensitive values anonymized)

FROM sales

SHOW net_items_sold

WHERE product.metafields.related_products.masterSKU IN (

'masterSKU-EXAMPLE-ALPHA',

'masterSKU-EXAMPLE-BETA',

'masterSKU-EXAMPLE-GAMMA',

'masterSKU-EXAMPLE-DELTA',

'masterSKU-EXAMPLE-EPSILON',

'masterSKU-EXAMPLE-ZETA'

)

AND customer_tags NOT CONTAINS ‘exclude’

AND order_tags NOT CONTAINS ‘exclude’

GROUP BY product_variant_sku

WITH TOTALS, PERCENT_CHANGE

SINCE 2026-02-10

UNTIL today

COMPARE TO previous_year

ORDER BY product_variant_sku ASC

LIMIT 1000

VISUALIZE net_items_sold TYPE table

(The six IN (...) values are placeholders; real values are product metafield masterSKU on our store.)


Problem

This query runs successfully in Shopify Admin → Analytics. The same string via shopifyqlQuery returns:

Metafield Column Not Found: Metafield ‘product.metafields.related_products.masterSKU’ not found

Invalid Expression: Field not found

tableData is null; errors are in parseErrors.


What we verified

  • Metafield definition (namespace: related_products, key: masterSKU, ownerType: PRODUCT): analyticsQueryable.eligible: true, analyticsQueryable.enabled: true (via metafieldDefinitions on API 2026-04).

  • App scopes (re-authorized): read_reports, read_products, read_orders, read_customers, plus inventory/locations/write_products.

  • API version: 2026-04 (also reproduced on 2025-10).

Hi @Miruna_Andriesei

My ShopifyQL query works perfectly. Would you mind sharing your query statement?

@kyle_liu it works for you in graphql with a product metafield?

FROM sales SHOW net_items_sold WHERE product.metafields.related_products.masterSKU IN (‘sku_1’, ‘sku_2’) AND customer_tags NOT CONTAINS ‘exclude-from-sales-analysis’
AND order_tags NOT CONTAINS ‘exclude-from-sales-analysis’ GROUP BY product_variant_sku WITH TOTALS, PERCENT_CHANGE SINCE 2026-02-02 UNTIL today COMPARE TO previous_year ORDER BY product_variant_sku ASC LIMIT 1000 VISUALIZE net_items_sold TYPE table

Hey folks - thanks for the report.

This looks to be the same underlying issue as another thread we’re already tracking, so I’m going to close this one and keep everything together over there:

Short version: it’s an unintentional side effect of a recent change to how third party apps are scoped when they query metafields, which is why your product metafield returns “not found” through shopifyqlQuery but still works in admin reporting. We’re working on a fix, and I’ll post updates in that thread as soon as I have them.

Thanks!