pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: Order statuses are decoupled from the back-end

Open fooman opened this issue 3 years ago • 11 comments

Describe the bug

A refunded order will show a wrong status. Custom order statuses are not shown.

To reproduce

Steps to reproduce the behavior: Refund an order in the admin. Create a custom order status and assign it to an order.

  1. navigate to /order-history
  2. notice PWA-Studio's own take on order statuses

Expected behavior

The frontend should accurately show the status of the order.

Possible solutions

Delete the logic around derivedStatus and display what the back-end provides?

Debug Report

Paste the output of yarn build:report, and any other context about the problem, here.

Please complete the following device information:

  • Device [e.g. iPhone6, PC, Mac, Pixel3]:
  • Browser [e.g. Chrome, Safari]:
  • Browser Version [e.g. 22]:
  • Magento Version [e.g Magento Commerce 2.4]:

Please let us know what packages this bug is in regards to:

  • [ ] venia-concept
  • [x] venia-ui
  • [ ] pwa-buildpack
  • [ ] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

fooman avatar Feb 23 '22 10:02 fooman

Hi @fooman. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Feb 23 '22 10:02 m2-assistant[bot]

A few other things not quite right with this implementation. Checking for 'Complete' would not work if the language is not English and/or the label was changed.

It's also a stretch to translate Complete to Delivered. In a default Magento environment the moment an order has an invoice and a shipment its status will change to Complete. At that point in time it would not have left the merchant's warehouse.

fooman avatar Feb 23 '22 10:02 fooman

@magento export issue to JIRA project PWA as Bug

anthoula avatar Feb 28 '22 14:02 anthoula

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2639 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Feb 28 '22 14:02 github-jira-sync-bot

As a further suggestion if the frontend should display differently depending on how far an order has objectively progressed relying on the order state https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Api/Data/OrderInterface.php#L29 would be the way to go. It is language independent and works in conjunction with custom order statuses.

fooman avatar Feb 28 '22 21:02 fooman

Hi @fooman,

Can you please give the detailed expected behavior of this ticket?

@RaghavendraTirumalasetti currently the frontend relies on the order status for its logic. This is problematic as order statuses can a.) be customised and b.) be translated.

It would be better to use the order state instead which only has a limited number of applicable states as well as being internal with no translations. The order state can now be queried via graphQl. In other respects following what Luma does would be my suggestion.

fooman avatar Jul 30 '23 22:07 fooman

@adobe export issue to JIRA project PWA as Bug

glo82145 avatar Sep 05 '23 06:09 glo82145

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3178 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Sep 05 '23 06:09 github-jira-sync-bot

Hi @fooman,

Steps that are followed to reproduce:

  • Refund an order in the admin.
  • Create a custom order status and assign it to an order.
  • change the status of the order from admin

Frontend not showing the right status of the order/ Status of the order remains same

For the fix as per the discussion, rather than using this derivedStatus, it should use the value of the state that is returning from GraphQL

Hence, this issue has been confirmed. We would appreciate your suggestions if there is anything that we are missing.

Thanks.

For the fix as per the discussion, rather than using this derivedStatus, it should use the value of the state that is returning from GraphQL

@RaghavendraTirumalasetti this is correct - nothing missed

fooman avatar Oct 04 '23 08:10 fooman