-
Notifications
You must be signed in to change notification settings - Fork 447
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
Connect to WooCommerce plugin #321
Comments
@oleksmir accidentally closed this. re-opened. I'm not super familiar with the WooCommerce REST API, but you can add whatever Types you want to the WPGraphQL Schema and have them resolve to whatever underlying data you want. Since WooCommerce (for now) uses Custom Post Types and Custom Taxonomies, you should be able to expose them to WPGraphQL by setting those post types to Then, to add custom fields to the Types, you can filter in new fields to each of the Types. So, in WooCommerce, there is a
You would now have a
I'm not familiar with how WooCommerce registers it's meta fields, but there's likely something you could do to get the fields that are registered to WooCommerce Post Types and loop through that existing registration and have it automatically add to WPGraphQL. You can see how @roborourke does something similar to dynamically add any meta fields that were added using Hope this helps. If you come up with anything good, please share! Would love to see a good WooCommerce + WPGraphQL extension or something to that tune. |
Hm, probably I'm too far away from WP to understand how it should be implemented, Main idea - wp-graphql is not enough to achieve expected results? Only create some additional plugin. Yes? |
wp-graphql is enough to achieve expected results... First step : Expose the Woocommerce
Second step : Resolve WooCommerce meta fields (example of
|
@szvest ya, for folks who want to hook and and create the Schema themselves you're correct! There's work being done by @kidunot89 to provide a WPGraphQL + WooCommerce plugin which has the Schema and (Types, Queries, Mutations and Resolvers) for all the data types in WooCommerce already scaffolded, so you could just activate that plugin and be ready to use all your WooCommerce data with GraphQL. Fairly early in the project, but he's moving quick! |
I made this last year: https://github.com/jkhaui/woocommerce-graphql I haven't tried it since WP 5.0.0, and I haven't been following this repo for a couple of months, but it should still work fine. Feel free to submit a PR |
Could you give me some guide or tutorial how to connect yours plugin to woocommerce and woocommerce rest api. I was searching information about it in your docs but did not find anything.
The text was updated successfully, but these errors were encountered: