Variation description display issue
-
I have a function in the site I’m in the process of updating to version 3 which adds/appends an anchor link to the product’s short description linking to the (long) description:
// Add anchor link/tag to short description linking to long description add_filter( 'woocommerce_short_description', 'storefront_short_description_with_anchor', 10, 1 ); function storefront_short_description_with_anchor( $product_short_description ) { global $product; global $post; if ( is_single() && is_product() ) $product_short_description = $product_short_description . '<p><a href="#learn-more" rel="learn-more">Learn more about ' . $post->post_title . '</a></p>'; return $product_short_description; }
It worked flawlessly in 2.6 (you can see an example on the live site running 2.6.14 here) and 3.0 and 3.0.1, but since 3.0.2 the function is also adding the
'<p><a href="#learn-more" rel="learn-more">Learn more about ' . $post->post_title . '</a></p>'
code to the variations form’s variation_description and thus when a variation is selected, to the woocommerce-variation-description div, which means once a variation is selected the'<p><a href="#learn-more" rel="learn-more">Learn more about ' . $post->post_title . '</a></p>'
code is outputted again below the variations table and above the price, e.g.:Screenshot: https://pasteboard.co/8TPIq5Ty3.jpg
Like I said, it worked fine in 2.6, 3.0 and 3.0.1 but I can’t work out what changed in 3.0.2 to cause this behaviour. A bug? Or my limited programming skills? I could hide the second output with CSS, but I’d rather fix it properly.
- The topic ‘Variation description display issue’ is closed to new replies.