wc_setup_product_data( mixed $post )
When the_post is called, put product data into a global.
Description Description
Parameters Parameters
- $post
-
(Required) Post Object.
Return Return
Source Source
File: includes/wc-template-functions.php
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']; }