Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (99 sloc) 2.69 KB
title description
WPGraphQL WooCommerce (WooGraphQL)
Expose WooCommerce in the WPGraphQL Schema

import GraphiQL from '../../components/GraphiQL' import Note from '../../components/Note' import Image from '../../components/Image'

WPGraphQL WooCommerce

WPGraphQL WooCommerce is a free, open-source WPGraphQL extension that adds WooCommerce functionality to the WPGraphQL API.

This plugin is still in the early stages of the development and may contain many bugs or lack some functionality. Using in production is not recommended.

Getting Started

  1. Install & activate WooCommerce
  2. Install & activate WPGraphQL.
  3. (Optional) Install & activate WPGraphQL-JWT-Authentication to add a login mutation that returns a JSON Web Token.
  4. Clone or download the extension & activate the WP GraphQL WooCommerce plugin

Playground

This is a playground connected to the most stable release of the extension. <GraphiQL endpoint='https://woographql.axistaylor.com/graphql' authButtons={{ Customer: ['customer', 'graphql_rocks'], ShopManager: ['shop_manager', 'graphql_rocks'], }} query=" { products { nodes { id productId name type price variations { nodes { id variationId } } } } } " withDocs={true} showJoyride={true} />

WooGraphQL has many features not available to anomymous user. Try selecting one of the users above and once the indicator on the button is green your logged in.

Here an example queries exclusive to registered customer.

    {`query {
  customer {
    firstName
    lastName
  }
  cart {
    contents {
      nodes {
        product {
          id
          name
          sku
        }
      }
    }
  }
}`}
  

Here a query exclusive to shop managers and administrators.

    {`query {
  orders {
    edges {
      cursor
      node {
        id
        orderId
        lineItems {
          nodes {
            itemId
            product {
              id
              name
              price
            }
            quantity
            total
          }
        }
        subtotal
        total
      }
    }
  }
}`}
  
You can’t perform that action at this time.