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
}
}
}
}
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.
@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.
When you say create a potential query? I barely know how to use GraphQL to be honest with you :disappointed:
@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.
@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 :thinking:
@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?
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.
Most helpful comment
@jasonbahl You mean something like this?
The thing is, I want my
metaDatato return the values based on keys of my choice.I hope it makes sense :thinking: