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

Support for Meta Objects? #1068

Open
jpboskdnz opened this issue May 15, 2024 · 7 comments
Open

Support for Meta Objects? #1068

jpboskdnz opened this issue May 15, 2024 · 7 comments
Labels

Comments

@jpboskdnz
Copy link

Hi,

Is there any way to use Shopify's Meta Objects from ShopifySharp? I would like to save some structured data into Meta Objects, but the only reference I see within ShopifySharp is in the generated GraphQL Schema.

Glad to hear, thanks!

Best regards,
JP

@tcorvin
Copy link

tcorvin commented May 21, 2024

Hey all,

I believe this is related so I’ll post here… I’m trying to access MetafieldService through ShopifySharp:
(I.e., var existingMetafields = await metafieldService.ListAsync(product.Id, "product");)
And am getting a 404…seems like I’m doing everything correctly, but also seems like this is going through (or trying to go through) GraphQL Admin interface vs. my other stuff (which is working AND is going thru restful admin API.)

Any thoughts appreciated!

Thanks,
Tyson

@jpboskdnz
Copy link
Author

jpboskdnz commented May 23, 2024

@tcorvin I don't think your question has anything to do with mine. Metaobjects and Metafields are different things in Shopify.
However, I can answer your question. You're missing a 's' in the resourceType. It should be "products".

@nozzlegear Do you have any thoughts on Metaobjects? I can use them using the GraphService, but it looks like a bit complex. If this the way to go at the moment?

@nozzlegear
Copy link
Owner

Oh yes, sorry, I meant to get back to your question when I added that label! Unfortunately it is indeed complex at the moment using the GraphService and the generated schema objects. I've been using Metaobjects recently for a client's app and it was a bit of a pain to work with, so I'm actively working on improving the whole GraphQL experience with ShopifySharp starting with deprecating a bunch of the unnecessary overloads in #1051.

After I get that merged in the next couple of days, my plan is to dive into #1072. I don't have a time estimate for that, but ultimately I want to have a dotnet tool that will let you write the graph queries you're going to use for your metaobjects, then this tool will create specialized ShopifySharp services with exactly the entities and methods needed to make those requests. So for contrived example, if you only need the id and displayName fields on a Metaobject, then this special Metaobject entity would only have those fields.

In the meantime, I'll try to find the example code I was using to create Metaobjects and definitions using the current GraphService.

@clement911
Copy link
Collaborator

@jpboskdnz I assume you've checked the API docs: https://shopify.dev/docs/api/admin-graphql/2024-04/objects/Metaobject

Using the GraphService, you should be able to do anything that is possible to do with the GraphQL API.
Using the GraphService is actually very simple once you've used it a couple of times.

What are you trying to do exactly?

@clement911
Copy link
Collaborator

Taking a look at the following file might be helpful:

public class Graph_SendTests

@jpboskdnz
Copy link
Author

Thanks @nozzlegear and @clement911 for pointing me into the right direction. Because we have created a somewhat complex structure in the Metaobjects, including translations in multiple languages, it's quite a work to put the data into Shopify using the GraphQL APIs. But it is what it is for now :-)

@mysteryx93
Copy link

Oh, so Metaobjects are not supported at all by this library?

It's like Ontraport Custom Objects, I implemented support here
https://github.com/mysteryx93/OntraportApi.NET?tab=readme-ov-file#custom-objects

Perhaps you could take inspiration from my design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants