Skip to main content
Upgrade to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use Polaris web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the upgrade guide to upgrade your extension and avoid being blocked from updating your extension after October 1st 2026.

Cost API

The Cost API provides the order's cost breakdown, including subtotal, shipping, tax, and total amounts. Use it to display order totals or format cost data for the buyer on the Order status page.

  • Display an order summary: Show a breakdown of the order cost, including the subtotal, shipping, tax, and total.
  • Highlight shipping costs: Display the shipping cost for the order, accounting for any shipping discounts that were applied.
  • Show tax details: Display the total tax amount for the order, or indicate when tax information is unavailable.

The Cost API object provides the order's cost breakdown. Access the following properties on the API object to read cost data.

required

The cost breakdown for the order, including subtotal, shipping, tax, and total amounts.


  • Handle undefined shipping and tax amounts: The totalShippingAmount and totalTaxAmount properties may be undefined if they haven't been calculated yet. Always check for undefined before rendering.
  • Use totalAmount for the final price: The totalAmount already accounts for all discounts, taxes, and shipping charges.

  • The Cost API doesn't include refund amounts. If the order has been partially or fully refunded, those adjustments aren't reflected in the cost properties.

Was this page helpful?