From 3befe1426f9a9bfceb3029132a9f1496020052c8 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Fri, 4 Dec 2015 15:17:25 -0500 Subject: [PATCH] Introduce WC_Product::get_id() method --- includes/abstracts/abstract-wc-product.php | 11 +++++++++++ includes/class-wc-product-variation.php | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index f1a89fc6e57..f5eba997db5 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -166,6 +166,17 @@ class WC_Product { 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. * diff --git a/includes/class-wc-product-variation.php b/includes/class-wc-product-variation.php index ca690af32e1..c939e2049d7 100644 --- a/includes/class-wc-product-variation.php +++ b/includes/class-wc-product-variation.php @@ -147,6 +147,17 @@ class WC_Product_Variation extends WC_Product { 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. *