Support for useSubtotalAmount on Order Status page

The useSubtotalAmount, and equivalent functions (e.g. useTotalTaxAmount) documented on Cost are only officially available on the “purchase” touchpoints.

We’d like to be able to access them on the OrderStatus page.

Please can we have the following hooks available on OrderStatus:

  • useSubtotalAmount
  • useTotalShippingAmount
  • useTotalTaxAmount

(useTotalAmount is available, although is not documented to exist on this touchpoint)

Hey @edhgoose,

Wondering why you want hooks for this vs reading directly from api.cost.subtotalAmount, api.cost.totalShippingAmount, etc?

Hooks are a convenience tool to subscribe to the value of the API (see implementation here), so that your extension gets the latest value if it’s updated. This wouldn’t be a concern on the order status page, since those values are static.

That’s exactly why I’d like them - it’s a convenience. It’s a bit easier to read, and fewer lines of code.

I’d add @Kenza_Iraki, it makes it a bit easier for someone who’s familiar with our Thank You page extension to be able to understand the code if it looks nearly identical on the Order Status page. Whereas atm, it’s very different.

I hear you, but unfortunately we’re not planning on adding any more hooks at this time.

Hi @Kenza_Iraki,

I’m a little surprised. Can you tell me more?

When we raised this previously for the useBillingAddress, your team quickly added it here: Add `SKU` and `useBillingAddress` hook for customer account UI extensions to stable by lihaokx · Pull Request #2600 · Shopify/ui-extensions · GitHub. They’ve done it for another, which I can’t see anymore, but was raised on the old GitHub issues.

Given it’s just a simple wrapper around the existing API, why wouldn’t there be a hook for it?

And, at the very least, shouldn’t the documentation reflect that the useTotalAmount is available on the Order Status page, and that you can get access to the values via the API using the code you suggested above? Is it not a bug in the documentation to suggest those values are not available?

Or is there some documentation that defines what values are available beyond the hook documentation I pointed to?

Ed