add shortcode in short description code example
Example 1: add shortcode in short description
<?php echo do_shortcode("[shortcode]"); ?>
Example 2: add shortcode in short description
remove_action( 'woocommerce_after_shop_loop_item', 'sp_loop_product_description', 6 );
add_action( 'woocommerce_after_shop_loop_item', 'wp_11326339_custom_description', 6 );
function wp_11326339_custom_description() {
global $product;
$wc_product = wc_get_product( $product );
if ( ! $wc_product ) {
return false;
}
$short_description = $wc_product->get_short_description();
if ( '' !== $short_description ) {
echo '<div itemprop="description">' . do_shortcode( wpautop( wptexturize( $short_description ) ) ) . '</div>';
}
}