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

Error deserializing the object of type SystemStatusTheme in SystemStatus #782

Open
ghhv opened this issue Sep 24, 2024 · 0 comments
Open

Comments

@ghhv
Copy link

ghhv commented Sep 24, 2024

  • Wordpress version, WooCommerce version and WooCommerce.NET version
    WooCommerce 9.3.1 on WordPress 6.6.2 with WooCommerceNET 0.8.6

  • Steps to replicate the issue
    wc.SystemStatus.Get() fails with error below.

My WordPress install is returning the following in SystemStatus which gives the error below.

"theme": {
        "author_url": "https://aweb.site",
        "has_outdated_templates": false,
        "has_woocommerce_file": false,
        "has_woocommerce_support": true,
        "is_child_theme": true,
        "name": "Theme Name",
        "overrides": [
            {
                "core_version": "3.6.0",
                "file": "awebsite/woocommerce/content-product.php",
                "version": "3.6.0"
            },
            {
                "core_version": "3.0.0",
                "file": "awebsite/woocommerce/single-product/up-sells.php",
                "version": "3.0.0"
            }
        ],
        "parent_author_url": "https://elementor.com/?utm_source=wp-themes&utm_campaign=author-uri&utm_medium=wp-dash",
        "parent_name": "Hello Elementor",
        "parent_version": "3.1.1",
        "parent_version_latest": "3.1.1",
        "version": "2.0.2",
        "version_latest": 0  **(this is also invalid or a bug)**
    },
  • Details of the error message if there is any
    This issue was raised previously: by @maxim-skuvault
    System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type WooCommerceNET.WooCommerce.v3.SystemStatus. End element 'item' from namespace '' expected. Found element 'file' from namespace ''. ---> System.Xml.XmlException: End element 'item' from namespace '' expected. Found element 'file' from namespace ''. at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)

    Any chance @XiaoFaye that this (and version_latest - see below) can be marked virtual so it can be overridden perhaps OR change to this class below?
    [DataMember(EmitDefaultValue = false)] public List<string> overrides { get; set; }

As per data sample, I'm getting an array of this object type in my data:

public List<Override>? overrides { get; set; }  (use this instead?)

public class Override
  {
      [JsonPropertyName("core_version")]
      public string? CoreVersion { get; set; }

      [JsonPropertyName("file")]
      public string? File { get; set; }

      [JsonPropertyName("version")]
      public string? Version { get; set; }
  }

You can see this in the WordPress source but they have not updated the API doc anywhere I could find to suit.

EXTRA ISSUE:
Strangely, my WordPress instance is also returning the number zero for theme.version_latest instead of a string (see above) which also causes SystemStatus.Get() to fail..
According to ChatGPT "likely means that WooCommerce was unable to retrieve the latest version of the theme from the WordPress.org theme repository". I'm using a child theme which makes sense but more likely a bug.

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

1 participant