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

Order Metafields #1083

Open
czupet opened this issue Jul 11, 2024 · 3 comments
Open

Order Metafields #1083

czupet opened this issue Jul 11, 2024 · 3 comments
Labels

Comments

@czupet
Copy link

czupet commented Jul 11, 2024

Is there a way to add Metafields to an order?

@Diceble
Copy link

Diceble commented Jul 12, 2024

Maybe you could elaborate a bit more on how you are using Shopifysharp now.
Do you want the GraphQL API to update your order with a metafield or are you using the RestAPI?
Did you try adding Metafields and didn't it work?

@czupet
Copy link
Author

czupet commented Jul 13, 2024

This is what I am doing today, I would like to change it to ShopifySharp, GraphQL would be great since they are moving towards that.

   var client = new HttpClient();
   var request = new HttpRequestMessage(HttpMethod.Put, $"https://{Username}:{Password}@{storeName}.myshopify.com/admin/api/2024-07/orders/{metaFields.Order.Id}.json");
   request.Headers.Add("Authorization", $"Basic {base64EncodedCredentials}");
   var content = new StringContent(meta, null, "application/json");
   request.Content = content;
   HttpResponseMessage response = await client.SendAsync(request);
   response.EnsureSuccessStatusCode();

@Diceble
Copy link

Diceble commented Jul 15, 2024

Am I correct in assuming you send credentials on every request? and the code you showed is this dev or prod code?
Besides that. I'd think you should just give a look at this (https://github.com/nozzlegear/ShopifySharp/wiki/Orders) to see how shopifysharp currently handles orders. If you do want to use graphQL I'd say read upon some documentation of Shopify itself and see what kind of request you need to make. Most likely you'll end up writing some mutation.

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

3 participants