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

Accessing meta_data product property? #121

Closed
stefanos82 opened this issue Aug 9, 2019 · 7 comments
Closed

Accessing meta_data product property? #121

stefanos82 opened this issue Aug 9, 2019 · 7 comments
Assignees
Labels
design notes Blueprint and notes for coming feature enhancement New feature or request
Milestone

Comments

@stefanos82
Copy link

Do we have meta_data product property, much like WC REST API?

I have tried the following which works just fine, but I'm missing the meta_data product property...

{
  products {
    edges {
      node {
        sku
        name
        status
        manageStock
        regularPrice
        salePrice
        dateOnSaleFrom
        dateOnSaleTo
        stockQuantity
        taxClass
      }
    }
  }
}
@kidunot89
Copy link
Member

Haven't implemented it yet, however I am putting this in the v0.2.1 milestone. I have implemented the MetaDataInput type to be used in Order and Checkout mutations, so this isn't far off.

@kidunot89 kidunot89 self-assigned this Aug 13, 2019
@kidunot89 kidunot89 added design notes Blueprint and notes for coming feature enhancement New feature or request labels Aug 13, 2019
@kidunot89 kidunot89 added this to the v0.2.1 milestone Aug 13, 2019
@kidunot89
Copy link
Member

@stefanos82 would it be possible for you do create a potential query? I'm still making decision what would work best for a meta data query.

@stefanos82
Copy link
Author

When you say create a potential query? I barely know how to use GraphQL to be honest with you 😞

@jasonbahl
Copy link
Collaborator

@stefanos82 if you were to have a component that was asking for data, how would you expect that query to look?

Mocking the shape of Queries can help identify issues before implementation.

@stefanos82
Copy link
Author

@jasonbahl You mean something like this?

{
  products {
    edges {
      node {
        sku
        name
        status
        manageStock
        regularPrice
        salePrice
        dateOnSaleFrom
        dateOnSaleTo
        stockQuantity
        taxClass
        metaData {
            key {
                internalCode
                uom
            }
        }
    }
  }
}

The thing is, I want my metaData to return the values based on keys of my choice.

I hope it makes sense 🤔

@kidunot89
Copy link
Member

@stefanos82 so since you want to filter by keys maybe something like.

{
  products {
    edges {
      node {
        sku
        name
        status
        manageStock
        regularPrice
        salePrice
        dateOnSaleFrom
        dateOnSaleTo
        stockQuantity
        taxClass
        metaData( keysIn: [ 'internalCode', 'uom' ] ) {
            key
            value
        }
    }
  }
}

and you would receive back an array that looks like this for the metaData field.

{
    metaData: [
        {
            "key": "internalCode",
            "value": "internalCodeValue"
        },
        {
            "key": "uom",
            "value": "uomValue"
        },
    ]
}

Any other suggestions?

@stefanos82
Copy link
Author

stefanos82 commented Aug 13, 2019

I guess we need interoperability between REST API and WPGraphQL so there's a consistency between the two.

The same fields we see from WC REST API would be ideal to have (more or less with the same syntax) in WPGraphQL.

It would be nice to generate REST API keys and use them with WPGraphQL as well.

I'm asking such feature, because I have a customer with a POS system that I send its data on a live website via REST API.

It takes around 1.7-ish seconds though to create a batch of 10 products and I would like to drop that speed as low as possible with the help of GraphQL.

Just see how many unnecessary data it retrieves that I don't really need: retrieve a product

With GraphQL I'm sure it would improve exponentially and I can't wait to figure out how to make it reality.

This was referenced Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design notes Blueprint and notes for coming feature enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants