Skip to content

Unable to view order as a guest #933

@sdegetaus

Description

@sdegetaus

Describe the bug
I believe there is a logic flaw in the WC_Order Root Query when trying to access an order as a guest. The suspect line is this one.

To my knowledge and according to the docs, the function get_current_user_id() will always return 0 when not logged in, making viewing an order as a guest impossible.

I am new to this plugin, so I may be missing some knowledge. However, since I am taking this theme (WooNuxt) as a starting point and since it is also failing to allow me to see my order as a guest, I believe this might be a bug:

Image

To Reproduce
Steps to reproduce the behavior:

  1. Go to WooNuxt
  2. Add a product to your cart
  3. Checkout (as a guest)
  4. You will be redirected to the thankyou page, but you will encounter the aforementioned error message: Not authorized to access this order.

Expected behavior
I am expecting to be able to see an order as a guest right after I place one.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Brave
  • Version: 1.77.97 Chromium: 135.0.7049.84 (Official Build) (64-bit)

Plugin Versions

  • WooGraphQL Version: 0.21.0
  • WPGraphQL Version: 2.1.1
  • WordPress Version: 6.8
  • WooCommerce Version: 9.8.1

Let me know if I am missing something 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions