So I need to display a widget through a shortcode [widget id="mks_author_widget-3"] on Wooocommerce’s single product page by adding it through functions.php. I’m using this plugin too create shortcodes for widgets https://wordpress.org/plugins/widget-shortcode/

Here’s what I’ve tried but it’s not working, it’s now showcasing widget’s content on a single product page:

add_filter( 'woocommerce_before_add_to_cart_form', 'custom_woocommerce_short_description' );

function custom_woocommerce_short_description( $description ) {
global $post;

$description = $description . do_shortcode('[widget id="mks_author_widget-3"]') ;

return $description;
}

Read more here: Adding widget through shortcode not working


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: