Menu
returnCalculate
Calculates the financial outcome of a Return without creating it. Use this query to preview return costs before initiating the actual return process.
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the returnCalculate action (under Return).
- Fill in the fields below, then reference the result from later steps as
{{returncalculate.response.data}}.
Query
This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.
query ReturnCalculate($input: CalculateReturnInput!) {
returnCalculate(input: $input) {
exchangeLineItems {
calculatedDiscountAllocations {
allocatedAmountSet
discountApplication
}
discountedUnitPriceSet {
presentmentMoney
shopMoney
}
id
originalUnitPriceSet {
presentmentMoney
shopMoney
}
quantity
subtotalSet {
presentmentMoney
shopMoney
}
totalTaxSet {
presentmentMoney
shopMoney
}
variant {
availableForSale
availablePublicationsCount
barcode
compareAtPrice
createdAt
defaultCursor
deliveryProfile
displayName
id
inventoryItem
inventoryPolicy
inventoryQuantity
legacyResourceId
position
price
product
publishedOnCurrentChannel
publishedOnCurrentPublication
requiresComponents
selectedOptions
sellableOnlineQuantity
sellingPlanGroupCount
sellingPlanGroupsCount
showUnitPrice
sku
storefrontId
taxCode
taxable
title
unitPrice
unitPriceMeasurement
updatedAt
}
}
id
returnLineItems {
fulfillmentLineItem {
discountedTotal
discountedTotalSet
id
lineItem
originalTotal
originalTotalSet
quantity
}
id
quantity
restockingFee {
amountSet
id
percentage
}
subtotalBeforeOrderDiscountsSet {
presentmentMoney
shopMoney
}
subtotalSet {
presentmentMoney
shopMoney
}
totalTaxSet {
presentmentMoney
shopMoney
}
}
returnShippingFee {
amountSet {
presentmentMoney
shopMoney
}
id
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"input": {
"orderId": "string",
"returnLineItems": [
{
"fulfillmentLineItemId": "string",
"quantity": "string",
"restockingFee": "string"
}
],
"exchangeLineItems": [
{
"quantity": "string",
"variantId": "string",
"appliedDiscount": "string"
}
],
"returnShippingFee": {
"amount": {
"amount": "string",
"currencyCode": "string"
}
}
}
}
Response
Read the result with {{returncalculate.response.data.data.returnCalculate}}. If the API returns errors, the step fails and they are at {{returncalculate.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?