Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Price not showing on products query #176

Closed
mehidi258 opened this issue Nov 21, 2019 · 4 comments
Closed

Price not showing on products query #176

mehidi258 opened this issue Nov 21, 2019 · 4 comments

Comments

@mehidi258
Copy link

mehidi258 commented Nov 21, 2019

I am using wp-graphql-woocommerce with wp-graphql and wp-graphiql
here is my query query MyQuery { products(first: 20) { nodes { productId slug name price } } }

it gives me an error Cannot query field "price" on type "Product".

@kidunot89
Copy link
Member

@mehidi258 the schema design was changed drastically in v0.3.0, if you are using WPGraphiQL, I recommend using the Explorer panel to view and get a general idea of what the schema shape

@ganeshpprasad
Copy link

I searched for price in wpgraphiql explorer but did not find. Can somebody please let me know how I can find price in products query

@kidunot89
Copy link
Member

kidunot89 commented Jul 6, 2020

@ganeshpprasad Here's an example query. Prices fields only exist on the SimpleProduct and VariableProduct type.

query ($id: ID!, $idType: ProductIdTypeEnum) {
	product(id: $id, idType: $idType) {
                id
		productId
		name
		... on SimpleProduct {
			price
			regularPrice
			salePrice
			dateOnSaleFrom
			dateOnSaleTo
		}
		... on VariableProduct {
			price
			regularPrice
			salePrice
			dateOnSaleFrom
			dateOnSaleTo
		}
	}
}

@sinapirani
Copy link

when I do this give this error:
"type": "DUPLICATE_FIELD", "message": "You cannot register duplicate fields on the same Type. The field 'isPrimary' already exists on the type 'ProductToPaAmperageConnectionEdge'. Make sure to give the field a unique name.", "field_name": "isPrimary", "type_name": "ProductToPaAmperageConnectionEdge",

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

No branches or pull requests

4 participants