Fixed $post when using product instance

This commit is contained in:
Claudio Sanches 2018-04-17 12:21:56 -03:00
parent c19836b0e4
commit 54b6174b34
1 changed files with 1 additions and 0 deletions

View File

@ -560,6 +560,7 @@ function wc_get_product_class( $class = '', $product_id = null ) {
if ( is_a( $product_id, 'WC_Product' ) ) { if ( is_a( $product_id, 'WC_Product' ) ) {
$product = $product_id; $product = $product_id;
$product_id = $product_id->get_id(); $product_id = $product_id->get_id();
$post = get_post( $product_id );
} else { } else {
$post = get_post( $product_id ); $post = get_post( $product_id );
$product = wc_get_product( $post->ID ); $product = wc_get_product( $post->ID );