Note: This plugin is in early stages and is not quite ready for use.
- Install & activate WooCommerce
- Install & activate WPGraphQL
- Clone or download the zip of this repository into your WordPress plugin directory & activate the WP GraphQL WooCommerce plugin
🚧If you get error upon activation and have CMD/Terminal access with Composer installed. Try running
composer dumpautoload -oin the
wp-graphql-woocommercedirectory in your WordPress installation's
What does this plugin do?
It adds WooCommerce functionality to the WPGraphQL schema using WooCommerce's CRUD objects.
- Query product, customers, coupons, order, refund, product variations.
- Connection Where Args.
- Adminstrator mutations. Eg. Creating and deleting products, coupons, orders and refunds
- Public/Customer mutations, Eg. Manipulating the cart and checking out. View Roadmap to see progress...
Until the documentation is in full effect, it's recommended that a GraphiQL-based tool like WPGraphiQL be used to view the GraphQL schema, an alternative to this is viewing the unit tests located in
tests/wpunit directory. Which are constantly updated along with the project. If you're interested in contributing when I begin accepting contribution or simply want to run the tests. Follow the instruction below.
Make sure all dependencies are install by running
composer installfrom the CMD/Terminal in the project directory.
Next the copy 5 distributed files with the
.distin there filenames. For instance
wpunit.suite.yml. The distributed files and what their copied names should are as follows.
.envand alter to make you usage.
# Shared TEST_DB_NAME="wpgraphql_woocommerce_test" TEST_DB_HOST="127.0.0.1" TEST_DB_USER="root" TEST_DB_PASSWORD="" # Install script WP_VERSION=latest SKIP_DB_CREATE=false WP_GRAPHQL_BRANCH=develop # Codeception WP_ROOT_FOLDER="/tmp/wordpress" TEST_SITE_WP_ADMIN_PATH="/wp-admin" TEST_SITE_DB_NAME="wpgraphql_woocommerce_test" TEST_SITE_DB_HOST="127.0.0.1" TEST_SITE_DB_USER="root" TEST_SITE_DB_PASSWORD="" TEST_SITE_TABLE_PREFIX="wp_" TEST_TABLE_PREFIX="wp_" TEST_SITE_WP_URL="http://wp.test" TEST_SITE_WP_DOMAIN="wp.test" TEST_SITE_ADMIN_EMAIL="email@example.com" TEST_SITE_ADMIN_USERNAME="admin" TEST_SITE_ADMIN_PASSWORD="password"
Sharedvariables are as the comment implies, variables shared in both the
install-wp-testsscript and the Codeception configuration. The variable names should tell you what they mean.
Install scriptvariables are specified to the
install-wp-testsscript, and most likely won't changed. I've listed their meaning below.
WP_VERSIONWordPress version used for testing
SKIP_DB_CREATEShould database creation be skipped?
WP_GRAPHQL_BRANCHThe branch in the
WPGraphQLrepository the tests should be run again. Ex.
Codeceptionvariables are specified to the Codeception configuration. View the config files and Codeception's Docs for more info on them.
Once you have finish modifying the
composer install-wp-testsfrom the project directory.
Upon success you can begin running the tests.
To run test use the command
vendor/bin/codecept run [suite [test [:test-function]]].
If you use the command with at least a
suite specified, Codeception will run all tests. This is not recommended. You better off running a suite
vendor/bin/codecept run wpunit or a tests
vendor/bin/codecept run CouponQueriesTest. You can all run single
test-function in a test like they
vendor/bin/codecept run CouponQueriesTest:testCouponQuery. To learn more about the usage of Codeception with WordPress view the Documentation
Support this extension