-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Why is product PublishedAt NullValueHandling as Include? #367
Comments
Unfortunately this is one of those damned if you do, damned if you don't kind of things. The NullValueHandling is set to include because it would be impossible to unpublish a product at all without it. If we were to set the NullValueHandling to ignore, the package wouldn't serialize or send the null value and then you can't unpublish the product. I'm open to any suggestions on how to better handle this, but for the time being, being able to send null values for |
I am wondering if we should also enforce returning that field on ProductService.Get/List, so that no one could pull a product, change some stuff, then send back the product and have it pause. |
I guess that wouldn't have helped this particular scenario though...no ideal solution unfortunately. |
It is a tricky one. |
My recommendation would be to use the separate publish and unpublish product methods that you already have written in the product service if you need to unpublish a product. So the developer knows they need to be explicit when doing that. With the way, it is in the SDK right now with any updates I need to make to the product it unintentionally unpublishes the product. Which ended up causing a significant bug for me and had a lot of my users complaint. |
Not a bad idea but ShopifySharp is a lightweight library and is intentionally designed to be a very thin layer over Shopify's REST api. |
Those methods already exist in this SDK library |
Oh I had totally missed that! |
I believe those used to be the only way, and we switched to also using nulls due to a request. This is just one of those things that is 6 of one, half dozen of another. |
Related issue: #284 |
I encountered this today, i resolved it by checking the I do like @moxplod idea of removing the ability to set
If i am not missing anything, a possible solution could be to add a |
ShopifySharp/ShopifySharp/Entities/Product.cs
Line 44 in dd7fb28
NullValueHandling = NullValueHandling.Include
Means it's being included in JSON blob as null even when all I am trying to do is update the product title or any other field.
Which unintentionally unpublishes the product on any product update.
Is there a reason for this as this is the only property in the entire library that has that attribute?
The text was updated successfully, but these errors were encountered: