WordPress at Your Fingertips
function is not described

wc_setup_product_data() WC 1.0

When the_post is called, put product data into a global.

No Hooks.

Return

WC_Product.

Usage

wc_setup_product_data( $post );
$post(mixed) (required)
Post Object.

Code of wc_setup_product_data() WC 5.6.0

function wc_setup_product_data( $post ) {
	unset( $GLOBALS['product'] );

	if ( is_int( $post ) ) {
		$post = get_post( $post );
	}

	if ( empty( $post->post_type ) || ! in_array( $post->post_type, array( 'product', 'product_variation' ), true ) ) {
		return;
	}

	$GLOBALS['product'] = wc_get_product( $post );

	return $GLOBALS['product'];
}