Skip to main content

productPrice

Overview

Use resolvePrice to calculate live pricing (e.g., for quick buy widgets) without touching the cart. Provide the product, optional variant/options, and quantity to get totals/savings plus the full product payload.

  • Type: GraphQL Mutation
  • Endpoint: https://subdomain.com
  • Authentication: Authorization: Bearer <TOKEN> (if your store requires customer context)

Mutation

mutation ResolvePrice($input: ResolvePriceInput!) {
resolvePrice(input: $input) {
success
message
data {
productId
variantId
price
compareAtPrice
totalPrice
totalCompareAtPrice
totalSavings
product {
_id
title
slug
description
app
tags
status
publishedAt
images { _id fileUrl }
collections {
_id
app
title
slug
description
operation
image { _id fileUrl }
}
seo { title description keywords image canonicalUrl }
pricing { compareAtPrice originalPrice price }
variantsCount
dimensions { height width unit }
weight { weight unit }
variants {
_id
product
options {
_id
option { name }
label
type
sortOrder
createdAt
updatedAt
}
images { _id fileUrl }
pricing { originalPrice price compareAtPrice }
quantity
weight { unit weight }
}
options {
_id
product
valuesCount
values { _id label type sortOrder createdAt updatedAt }
name
createdAt
updatedAt
}
}
}
}
}

Variables

{
"input": {
"productId": "<PRODUCT_ID>",
"variantId": "<VARIANT_ID>",
"quantity": 2,
"options": [
{ "name": "size", "value": "M" }
]
}
}

Examples

curl -X POST \
https://subdomain.com\
-H "Content-Type": "application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "mutation ResolvePrice($input: ResolvePriceInput!) { resolvePrice(input: $input) { success message data { productId totalPrice totalSavings } } }",
"variables": {
"input": {
"productId": "<PRODUCT_ID>",
"variantId": "<VARIANT_ID>",
"quantity": 2
}
}
}
EOF

Notes

  • Great for previewing quick buy totals or building custom pricing calculators.
  • Respect store-specific validation (stock, minimum quantity) and use message to display errors.