WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

CartController::get_product_id() protected WC 1.0

For a given product, get the product ID.

{} It's a method of the class: CartController{}

No Hooks.

Return

Int.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_product_id( $product );
$product(WC_Product) (required)
Product object associated with the cart item.

Code of CartController::get_product_id() WC 5.8.0

protected function get_product_id( \WC_Product $product ) {
	return $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id();
}