My company operates a sales channel for a large number of Shopify customers. We support selling subscriptions, and pull information about a variant’s subscription options from both the Admin API and the Storefront API. We’ve noticed that in a lot of cases, these two APIs don’t agree with each other about pricing or price adjustments for the same variants and selling plans, and so I’m hoping to get some guidance on which API we should be using for our use case.
What we see in most cases is that the priceAdjustments
field on Storefront API’s SellingPlanAllocations
provides accurate price
and compareAtPrice
values (that is, values that match what is shown on a merchant’s online store for the variant/selling-plan combo), but the percentages in the priceAdjustments
field on the corresponding Storefront API SellingPlan
resource are not accurate (that is, reducing the compareAtPrice
by the provided percentage does not result in the same price
reported by Storefront API). On the other hand, if we fetch the same SellingPlan
via Admin API and check its pricingPolicies
field, it reports percentage-off adjustments that do equal the difference between the Storefront API price
and compareAtPrice
fields (plus or minus some small rounding error in some cases).
As an example, for one product variant / selling plan combination that we have access to, the Storefront API reports a price
value of 132.01, and a compareAtPrice
value of 140. The actual difference between these values is 5.707%. However, the SellingPlan
from Storefront API reports a SellingPlanPercentagePriceAdjustment
with a value of 5 - using this percentage to calculate a sale price would not result in an accurate price for consumers. Admin API’s representation of the same SellingPlan
, on the other hand, reports a SellingPlanRecurringPricingPolicy
whose adjustmentType
is “PERCENTAGE” and whose adjustmentValue
is 5.71. This discount percentage is accurate, though a bit imprecise.
To summarize, what I’m seeing is that Storefront API provides accurate prices but inaccurate adjustments, while Admin API provides (roughly) accurate adjustments but no real-world price data for selling plans. Is this expected, or am I missing some way to get the actual sale price for a variant/selling-plan combination via Admin API? I can’t find an answer to this question in the API docs, so I’d love some guidance on which of these APIs we should use to display accurate configuration info to merchants in our admin panel and accurate prices to consumers in our sales channel. In particular, I’d love to know if it’s possible to get fully accurate pricing information using only the Admin API, as we’d prefer not to have to make two API requests for every selling plan in order to have complete information.
Thanks in advance!