Skip to content

Add getVariantsByIds: variant-level presentment prices - #152

Merged
imsujan276 merged 4 commits into
imsujan276:mainfrom
qeepcologne:variant-prices-by-ids
Aug 27, 2026
Merged

Add getVariantsByIds: variant-level presentment prices#152
imsujan276 merged 4 commits into
imsujan276:mainfrom
qeepcologne:variant-prices-by-ids

Conversation

@qeepcologne

Copy link
Copy Markdown
Contributor

Adds ShopifyStore.getVariantsByIds — a variant-level lookup that returns presentment prices.

Why

There is currently no way to ask this package for the price of a known set of variants in a given market.

  • getProductsByIds looks like the right call, but its query matches ... on Product. nodes(ids:) is polymorphic, so passing variant gids returns empty entries — silently, not as an error.
  • The product queries can't stand in either. getProductsQuery nests products(first: 250)variants(first: 250)sellingPlanAllocations(first: 250), plus collections(250), images(250) and media(250). Against a real catalogue that is orders of magnitude past the Storefront API's 1000-point query-cost limit, and it comes back as a bare Internal error. Looks like something went wrong on our end. with a request id rather than a cost message.

What

get_variants_by_ids.dart selects no nested connections, so the query costs roughly one point per id. It runs under @inContext(country: $country) like the other queries and is fed ShopifyLocalization.countryCode, so the prices are the presentment prices for the selected market. Ids that don't resolve to a variant are skipped.

The selected fields are exactly what ProductVariant.fromJson needs, so the method returns the package's own model rather than a bespoke shape.

Note on stacking

This branch sits on top of #150 and #151, so the diff here includes both. Happy to rebase onto whatever lands first, or to split it if you'd rather take this one on its own.

🤖 Generated with Claude Code

@imsujan276
imsujan276 merged commit 26e9200 into imsujan276:main Aug 27, 2026
1 of 2 checks passed
@qeepcologne
qeepcologne deleted the variant-prices-by-ids branch August 28, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants