pwa-studio
pwa-studio copied to clipboard
[bug]: Order statuses are decoupled from the back-end
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.
- navigate to /order-history
- 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
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
- Join Magento Community Engineering Slack and ask your questions in #github channel.
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.
@magento export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2639 is successfully created for this GitHub issue.
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.
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.
@adobe export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3178 is successfully created for this GitHub issue.
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