wc_post_content_has_shortcode()WC 1.0

Checks whether the content passed contains a specific short code.

No Hooks.

Return

true|false.

Usage

wc_post_content_has_shortcode( $tag );
$tag(string)
Shortcode tag to check.
Default: ''

wc_post_content_has_shortcode() code WC 8.7.0

function wc_post_content_has_shortcode( $tag = '' ) {
	global $post;

	return is_singular() && is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, $tag );
}