wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
638 stars 129 forks source link

price(format: RAW) returns null for VariableProduct #479

Closed kdotamoh closed 2 years ago

kdotamoh commented 3 years ago

Describe the bug price(format: RAW) returns null for VariableProduct

To Reproduce Steps to reproduce the behavior:

query GetProductsQuery {
    products(first: 20) {
      nodes {
        id
        ... on VariableProduct {
          id
          name
          variations {
            nodes {
              price(format: RAW)
            }
          }
        }
      }
    }
  }

Expected behavior Get price without a currency symbol

Screenshots In GraphiQL the price displays with no issue but returns null in the browser: image image

Desktop (please complete the following information):

Plugin Versions

Additional context It looks like the issue was solved for SimpleProducts #207, but persists for VariableProducts.

phidalgot commented 3 years ago

Good afternoon, I have the same problem with next.js

jacobarriola commented 3 years ago

@kdotamoh I think it may be an authentication issue. I know for stock wp-graphql fields like content in the Post type, adding the RAW param is an authenticated request, which is why it works in GraphiQL (because you're authenticated) but null in the browser.

kdotamoh commented 3 years ago

@jacobarriola Interesting, that sounds plausible. If that's the case visitors to a website (who aren't authenticated) will be unable to view variable products. Sounds like a bug, no?

Or does the authentication have to be done in development? I don't have access to the project right now, so I can't test this out

devidw commented 1 year ago

Still experiencing the same behaviour with variable products.

In both cases, a user is authenticated.

Sorry if I am missing something?


WooCommerce 7.1.0 WP GraphQL 1.12.1 WPGraphQL WooCommerce (WooGraphQL) 0.11.2