Shopify Refund Order Line Items and Shipping Fee

Advanced refund action that refunds specific line items together with a proportional share of the shipping fee. Includes safety checks, duplicate protection and a soft-launch mode for testing.

What it does

  • Fetches the order by its internal Shopify order ID.
  • Records the refund attempt in a Shopify metaobject for audit and rate-limiting.
  • Runs safety checks (refund frequency limits and duplicate detection via metafields).
  • Calculates the shipping portion to refund proportionally based on item quantity or weight.
  • Calls the Shopify Calculate and Create Refund endpoints with full line-item detail.
  • Marks the order with a digitalgenius.is_refunded metafield after success.

Notes

  • Uses the internal Shopify order ID, not the visible order number.
  • Three refund modes: full (all items + all shipping), percentage of items quantity (selected items + shipping by quantity ratio), or percentage of items weight (selected items + shipping by weight ratio).
  • Safety limits block the action if too many refunds are detected (20/hour, 60/12h, 100/24h).
  • Soft Launch mode calculates the refund without executing it, useful for testing flows.
  • Items are not restocked by this action.
  • Requires the $app:order_refund metaobject definition to exist in the Shopify store.

Inputs

NameTypeDescription
Shopify SubdomainCredentialsStore subdomain
Shopify TokenCredentials (sensitive)Admin API access token
Order IDStringInternal Shopify order ID (numeric)
Type of RefundStringfull, percentage of items quantity, or percentage of items weight
List of Line ItemsListIDs of line items to refund (required for partial refunds)
Soft LaunchBooleanWhen true, only calculates without executing the refund
Reason for RefundStringStored as the refund note

Outputs

NameTypeDescription
SuccessBooleanWhether the refund was processed (or calculated in soft-launch mode)
AmountStringFormatted refund amount (e.g. $12.50 USD)
Refund DetailsObjectFull Shopify refund response object

API reference