Introduce WC_Product::get_id() method

This commit is contained in:
Max Rice 2015-12-04 15:17:25 -05:00
parent 0f5c70e33f
commit 3befe1426f
2 changed files with 22 additions and 0 deletions

View File

@ -166,6 +166,17 @@ class WC_Product {
return apply_filters( 'woocommerce_product_supports', in_array( $feature, $this->supports ) ? true : false, $feature, $this ); return apply_filters( 'woocommerce_product_supports', in_array( $feature, $this->supports ) ? true : false, $feature, $this );
} }
/**
* Return the product ID
*
* @since 2.5.0
* @return int product (post) ID
*/
public function get_id() {
return $this->id;
}
/** /**
* get_gallery_attachment_ids function. * get_gallery_attachment_ids function.
* *

View File

@ -147,6 +147,17 @@ class WC_Product_Variation extends WC_Product {
return $value; return $value;
} }
/**
* Return the variation ID
*
* @since 2.5.0
* @return int variation (post) ID
*/
public function get_id() {
return $this->variation_id;
}
/** /**
* Returns whether or not the product post exists. * Returns whether or not the product post exists.
* *