WooCommerce.NET
WooCommerce.NET copied to clipboard
GetAll()/Get() in Order - Problem
- Wordpress version, WooCommerce version and WooCommerce.NET version
- WooCommerce V3
- WooCommerce.NET 0.8.3
- Steps to replicate the issue
- call await _wcObject.Order.GetAll() or await _wcObject.Order.Get()
- Details of the error message if there is any
Error message:
There was an error deserializing the object of type System.Collections.Generic.List 1[[WooCommerceNET.WooCommerce.v3.Order, WooCommerce.NET, Version=0.8.3.0, Culture=neutral, PublicKeyToken=ff41d0b6c937438d]]. End element 'display_value' from namespace '' expected. Found element 'id' from namespace ''.
Json to debug: jsonDebug.txt
- Wordpress version, WooCommerce version and WooCommerce.NET version
- WooCommerce V3
- WooCommerce.NET 0.8.3
- Steps to replicate the issue
- call await _wcObject.Order.GetAll() or await _wcObject.Order.Get()
- Details of the error message if there is any Error message:
There was an error deserializing the object of type System.Collections.Generic.List 1[[WooCommerceNET.WooCommerce.v3.Order, WooCommerce.NET, Version=0.8.3.0, Culture=neutral, PublicKeyToken=ff41d0b6c937438d]]. End element 'display_value' from namespace '' expected. Found element 'id' from namespace ''.
Json to debug: jsonDebug.txt
We have the same issue!
display_value property of meta_data is supposed to be string type but since Woo update this morning, it could be one of these 3 values: string json array another json object
When returned display_value is not string it will caused deserialization errors. These happened to us after we have updated woo plugin this morning and happened on order line meta and order coupon line meta.
Is there a fix for this? Or a workaround to get past this? This is quite urgent
Hi, we have this over many sites 👎
The bad plug in could be :- WooCommerce Product Bundles Offer product bundles, bulk discount packages and assembled products. Version 6.8.0 - There is a version 6.10 will test and implement this SomewhereWarm
This is creating a JSON array for the Display_Value of an order line with heaps of data in there.
https://woocommerce.com/products/product-bundles/
Can anyone else check if this is the case?
OK I have been working with the plugin developer this is a change in Woo which any plugin could cause ...
This is Jason again, following up on my last reply!
I had a chat about this with our Engineering team and it seems that some of the details I shared in my previous e-mail were not entirely accurate -- that's why I decided to follow-up here so that you have the correct details to share with the developers of the WooCommerce.NET plugin.
Every order item meta has a display_key/display_value pair -- however, the values in these fields are not always formatted. If they are not formatted, then they are identical to the values you see in the key/value pair.
These meta are formatted in a more user-friendly way only if they are going to be displayed in pages viewed by customers -- for example the cart page. In any other case, they are not formatted.
Therefore, the best way to proceed here is to ask the WooCommerce.NET developers to skip these values if they are identical to the ones in the key/value fields. Another option is to skip these values for hidden meta data as these data will never be displayed to customer-facing pages.
Let me know how this goes!
Cheers,
Jason Support Escalation and Test Engineer
Thanks for reaching out and for bringing this to our attention!
WooCommerce core adds a display_key/display_value pair to some meta data to display them in a more readable format. For example, if the initial value of the meta was array(one, two, three...) then this could be converted to: one, two, three… to be more readable.
Are you using the source or the latest 0.8.3 release? It should be fixed in #600 but has not been released yet. Build from the source and check please.
Yes we used the 0.8.3 release, we will try to test this asap from source when we get a chance as this was a pretty major issue for us.
Thanks!
Also note that WCObject.MetaDisplayValueProcessor
was added if you need to parse the display_value object.
#612 (comment)
Same problem here. Also version 0.8.3. Any workaround?
Same problem here. Also version 0.8.3. Any workaround?
You'll have to compile the source code.
Same problem here. Also version 0.8.3. Any workaround?
You'll have to compile the source code.
Nice. It works. Thanks!
I thought it should be solved in #600 but I get the same error when get all payment gateways . (WooCommerce.NET, Version=0.8.4.0 ) . Please let me know your solution . code :
List<PaymentGateway> pgs = wc.PaymentGateway.GetAll().Result;
Error :
System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type System.Collections.Generic.List
1[[WooCommerceNET.WooCommerce.v3.PaymentGateway, WooCommerce.NET, Version=0.8.4.0, Culture=neutral, PublicKeyToken=null]]. End element 'value' from namespace '' expected. Found element 'item' from namespace ''. ---> System.Xml.XmlException: End element 'value' from namespace '' expected. Found element 'item' from namespace ''.
`