Support » Plugin: WooCommerce » Error in wc-template-functions.php V 2.67

  • This is not a support request, it is a bug report and don’t have my GitHub creds handy.

    Wordpress 4.61
    WC V 2.67

    Status is moot, it is clear and not provided (everything working fine)
    site http://www.scribblings-n-stuff.com/shop , but you won’t see the error as I’ve patched it.

    Updated WC to 2.67 and came across this, don’t know if it’s a long standing error or this version. You have a double quote kicking invalid HTML warnings/errors.

    This would occur the data attribute on any variant product with options.

    wcommerce/includes/wc-template-functions.php

    On line 2076, (below formatted multi-line for clarity.)

    $html = '<select id="' .
    	esc_attr( $id ) .
    	'" class="' .
    	esc_attr( $class ) .
    	'" name="' . esc_attr( $name ) .
    	'" data-attribute_name="attribute_' .
    	esc_attr( sanitize_title( $attribute ) ) .
    	<strong>'"' .	// <----- error</strong>
    	'" data-show_option_none="' .
    	( $show_option_none ? 'yes' : 'no' ) .
    	'">';

    creates

    <select id="pa_24-x-18" class="variations-select" name="attribute_pa_24-x-18" data-attribute_name="attribute_pa_24-x-18"<strong>"</strong> data-show_option_none="yes">

    Kicks “no space between attributes” error due to extra quote.

    Should be

    $html = '<select id="' .
    	esc_attr( $id ) .
    	'" class="' . esc_attr( $class ) .
    	'" name="' . esc_attr( $name ) .
    	'" data-attribute_name="attribute_' .
    	esc_attr( sanitize_title( $attribute ) ) .
    	'" data-show_option_none="' .
    	( $show_option_none ? 'yes' : 'no' ) .
    	'">'
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter SurfSD

    (@surfsd)

    Apologies, been a long time since I’ve shared code here and didn’t realize the bold’s would not parse. Ignore the STRONG tags, here is a clear code chunk of the error:

    $html = '<select id="' .
    	esc_attr( $id ) .
    	'" class="' .
    	esc_attr( $class ) .
    	'" name="' . esc_attr( $name ) .
    	'" data-attribute_name="attribute_' .
    	esc_attr( sanitize_title( $attribute ) ) .
    	'"' .	// <----- error
    	'" data-show_option_none="' .
    	( $show_option_none ? 'yes' : 'no' ) .
    	'">';
    Plugin Support RK a11n

    (@riaanknoetze)

    Are you sure about that line number and the WooCommerce version number? Looking at the Github repo, line 2076 looks as follows: https://github.com/woocommerce/woocommerce/blob/master/includes/wc-template-functions.php#L2076

    The closest code that resembles that is found on https://github.com/woocommerce/woocommerce/blob/master/includes/wc-template-functions.php#L2151 but there’s no <strong> tag being used.

    Am I missing something obvious here?

    Thread Starter SurfSD

    (@surfsd)

    Thank you, yes. Look at the second post. It’s not the strong tags, those were errantly added here.

    What’s interesting is the repo commit says

    claudiosanches Removed extra quote from variations attribute dropdown, closes #12251

    “Updated three days ago” but I updated WC **yesterday** and the extra quote was still there.

    I can confirm that this still exists in production version 4.7.2 as of today.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error in wc-template-functions.php V 2.67’ is closed to new replies.