• My website https://www.travelideology.com is reporting W3c compliance errors as follows that appear to be generated from woocommerce for product pages.

    As an example see https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.travelideology.com%2Fshop%2Fbrands%2Feagle-creek%2Fpack-it-on-board%2F

    Errors are related to two blocks of woocommerce text in the code:
    1.
    <img width="200" height="200" src="/wp-content/uploads/2016/03/on-board-200x200.jpg" class="attachme…00.jpg 300w, /wp-content/uploads/2016/03/on-board.jpg 600w" sizes="(max-width: 200px) 100vw, 200px">
    Error: Attribute caption not allowed on element img at this point.
    Error: Attribute url not allowed on element img at this point.

    2.
    <input type="number" step="1" min="1" max="" name="quantity" value="1" title="Qty" class="input-text qty text" size="4" pattern="[0-9]*" inputmode="numeric">

    Error: Bad value for attribute max on element input: The empty string is not a valid floating point number.
    Error: Attribute inputmode not allowed on element input at this point.
    Error: Attribute pattern is only allowed when the input type is email, password, search, tel, text, or url.
    Warning: The inputmode attribute is not supported in all browsers. Please be sure to test, and consider using a polyfill.

    If someone can tell me how to fix these or where to find the code I would be very appreciative.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • for 1. Use this in functions.php, or own plugin (better):

    add_filter( 'wp_get_attachment_image_attributes', 'remove_image_text' );
    function remove_image_text( $attr ) {
        unset( $attr['caption'] );
      	unset( $attr['url'] );
        return $attr;
    }

    Thanks, simppa69, that worked for me. ??

    I have also problem 2.
    It seems to be related with the “sell only one piece” ( I don’t know the english name of the checkbox at the moment, my wordpress is in german) at stock under products. If I set this checkbox the error is gone. I have only virtual and downloadable products.
    Maybe this helps to find the problem and fix it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Valiidation errors’ is closed to new replies.