0

I am facing this issue at home page after click on reorder in my order at frontend.

1 Answer 1

1

The issue: One of your widget.xml files missing required child element(s), which causes this error:

Invalid Document Element 'widget': Missing child element(s). Expected is one of ( label, description, containers ). Line: 4

The widget requires label and description elements. You can read more from Magento official document https://developer.adobe.com/commerce/php/tutorials/frontend/create-custom-widget/

Solution:
You can detect which file has a problem by adding debug code in vendor/magento/framework/Config/Dom.php, inside validate method, after the following code:

if ($this->validationState->isValidationRequired()) {
    $errors = $this->validateDomDocument($this->dom, $schemaFileName, $this->errorFormat);

Add this code:

if (count($errors)) {
    var_dump($this->dom->textContent);
    die();
}

Clear cache and go to the page which has the error, you will see the text content of the widget file which has the problem. Copy some text to find in the whole project, and you will see the widget.xml file which causes the error.

Open the error file, go to line 4 (that line mentioned in the error message above), which is the widget that caused the error, and add label and description elements to that widget to resolve the issue.

Clear cache and see the result.

Once you resolve all errors, remove the debugging code in vendor/magento/framework/Config/Dom.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.