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

SerializationException: The value "parent" cannot be parsed as a type "Boolean" #722

Closed
dartrax opened this issue Dec 23, 2022 · 7 comments

Comments

@dartrax
Copy link

dartrax commented Dec 23, 2022

  • Wordpress version 6.1.1, WooCommerce version 7.2.2 and WooCommerce.NET version 0.8.4

This works:

Dim p = Await Woo.Product.GetAll(New Dictionary(Of String, String) From {{"slug", "my-product-slug"}})
Process.Start(p.First.permalink)

This does not work:

Dim p = Await Woo.Product.GetAll(New Dictionary(Of String, String) From {{"sku", "12345678"}})
Process.Start(p.First.permalink)

In my test both calls to GetAll should deliver the same product (my-product-slug is the slug of the product with the sku 12345678)

The error is:

System.Runtime.Serialization.SerializationException: "Error deserializing object "of type System.Collections.Generic.List`1[[WooCommerceNET.WooCommerce.v3.Product, WooCommerce.NET, Version=0.8.4.0, Culture=neutral, PublicKeyToken=ff41d0b6c937438d]]". The value "parent" cannot be parsed as type "Boolean"."

XmlException: the value "parent" cannot be parsed as type "Boolean".

FormatException: The string 'parent' not a valid Boolean value.
@dartrax
Copy link
Author

dartrax commented Jan 5, 2023

Thanks for your ongoing development of this library!
This bug is still present in version 0.8.5

@XiaoFaye
Copy link
Owner

XiaoFaye commented Jan 9, 2023

I don't get this error on local testing, do you mind uploading the returned json details so I can check?

@dartrax
Copy link
Author

dartrax commented Jan 10, 2023

Thanks for looking into it. I've uploaded only an excerpt of the json, please let me know if you need the whole thing. I believe this is the culprit:

... 
"tax_status":"taxable","tax_class":"","manage_stock":"parent","stock_quantity":12,"backorders":"no",
...

So manage_stock isn't boolean, it has the value "parent", probably because the SKU I'm requesting is a product variant which shares stock with the parent:

image

The reason why it works using the product slug instead of SKU is probably because the product slug refers to the parent while the SKU refers to a child variant of that parent.

@Mattoia90
Copy link

I have the same problem with Variation products.
When I use Postman I see < "manage_stock":"parent" > but in the class product is typed: bool?

@XiaoFaye
Copy link
Owner

It's defined as bool in WC's document, however when in variation products, it could be a string with value "parent". Will fix this in the next version.

@XiaoFaye
Copy link
Owner

@dartrax This is fixed in version 0.8.6.

@dartrax
Copy link
Author

dartrax commented Mar 29, 2023

Perfect! Confirming it's fixed now.

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

No branches or pull requests

3 participants