Shopify / ui-extensions

MIT License
269 stars 35 forks source link

useSelectedPaymentOptions for Order Status page #2259

Open edhgoose opened 3 months ago

edhgoose commented 3 months ago

Please list the related package(s)

checkout-ui-extensions

If this related to specific APIs or components, please list them here

useSelectedPaymentOptions

Is your feature request related to a problem? Please describe.

Somewhere between 2024-04 and 2024-07 the documentation for the useSelectedPaymentOptions method changed from:

The base API object provided to purchase, and customer-account.order-status extension targets.

to:

The base API object provided to purchase extension targets.

We would like the API to be consistent between the order status and thank you pages so that we can run identical code. We also wish to make a decision on both pages of what to show to a customer based on the payment method chosen so having it not work on one, but work on the other may cause different decisions to be made leading to different application behaviour.

Describe the changes you are looking for

Provide useSelectedPaymentOptions on the Order Status page.

(Or, alternatively, provide documentation as to why it's unavailable).

Describe alternatives you’ve considered

I've tried to identify why it was removed in a changelog, but I can find any reference in either:

The Updating Guide on Shopify.dev or The changelog for this repository

Documentation on changes like this would be appreciated - even if it's a documentation mistake that was incorrect the first time.

Additional context

jamesvidler commented 3 months ago

The base API object provided to purchase extension targets.

To clarify, the purchase extension targets do in-fact include the thank you page (purchase.thank-you). The thank you page does have the ability to read the selected payment. However, the customer-account.order-status page does not, since it is outside the context of a purchase (it has already happened). That being said, I can understand why it would be helpful to have the same API on the order status page. Thank you for your feedback, and we'll take this into consideration as we look to unify APIs where it makes sense to.

edhgoose commented 3 months ago

Thanks @jamesvidler - are you able to confirm that the previous version was a mistake in the documentation? And downgrading to that version wouldn't restore the functionality?

I infer that from your answer but would appreciate confirmation.

Thanks!