On your WordPress website that uses WooCommerce for ecommerce you may want to allow shortcodes in the product excerpts on there. To do that without a plugin you can then add this code to your functions.php file. You may want to backup your WordPress website before you make updates the file on there.
Update to allow shortcodes in product excerpts on WooCommerce
/** * Update to allow shortcodes in product excerpts * * @author WPSnacks.com * @link https://www.wpsnacks.com */ if (!function_exists('woocommerce_template_single_excerpt')) { function woocommerce_template_single_excerpt( $post ) { global $post; if ($post->post_excerpt) echo '<div itemprop="description">' . do_shortcode(wpautop(wptexturize($post->post_excerpt))) . '</div>'; } }
Now if that works for you it would allow shortcodes in WooCommerce product excerpts on your WordPress website on there.
Leave a Reply