Skip to content

Fix guest checkout 'Order not found' on order-placed page#32

Merged
damianlegawiec merged 1 commit intomainfrom
fix-checkout-guest
Feb 24, 2026
Merged

Fix guest checkout 'Order not found' on order-placed page#32
damianlegawiec merged 1 commit intomainfrom
fix-checkout-guest

Conversation

@Cichorek
Copy link
Contributor

Problem

Guest checkout was showing "Order not found" on the order-placed page due to a race condition where getCart() cleared the cart token cookie before getCheckoutOrder() could use it for authentication.

Solution

Skip the refreshCart() call when navigating to the order-placed page. Instead, directly clear the cart state to prevent the race condition while still maintaining proper state cleanup.

Changes

  • Add pathname check in the useEffect hook to detect order-placed page navigation
  • Clear cart state directly without calling refreshCart() on order-placed pages
  • Updated comments to explain the race condition and solution

Skip CartProvider's refreshCart() on the order-placed page to prevent
a race condition where getCart() auto-clears the _spree_cart_token
cookie before getCheckoutOrder() can use it. For guest users this
token is the only authentication — once cleared, the API returns
nothing and the confirmation page shows "Order not found."

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Cichorek Cichorek self-assigned this Feb 23, 2026
@Cichorek Cichorek assigned damianlegawiec and unassigned Cichorek Feb 23, 2026
@damianlegawiec damianlegawiec merged commit 6ddaafa into main Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants