WordPress at a glance
function is not described

WC_Product_Factory::get_product() WC 1.0

Get a product.

This is a method of the class: WC_Product_Factory

No Hooks.

Return

WC_Product/true/false. Product object or false if the product cannot be loaded.

Usage

$WC_Product_Factory = new WC_Product_Factory();
$var = $WC_Product_Factory->get_product( $product_id, $deprecated );
$product_id(mixed)
WC_Product|WP_Post|int|bool $product Product instance, post instance, numeric or false to use global $post.
Default: false
$deprecated(array)
Previously used to pass arguments to the factory, e.g. to force a type.
Default: array()

Code of WC Product Factory::get product: woocommerce/includes/class-wc-product-factory.php WC 3.7.0

<?php
public function get_product( $product_id = false, $deprecated = array() ) {
	$product_id = $this->get_product_id( $product_id );

	if ( ! $product_id ) {
		return false;
	}

	$product_type = $this->get_product_type( $product_id );

	// Backwards compatibility.
	if ( ! empty( $deprecated ) ) {
		wc_deprecated_argument( 'args', '3.0', 'Passing args to the product factory is deprecated. If you need to force a type, construct the product class directly.' );

		if ( isset( $deprecated['product_type'] ) ) {
			$product_type = $this->get_classname_from_product_type( $deprecated['product_type'] );
		}
	}

	$classname = $this->get_product_classname( $product_id, $product_type );

	try {
		return new $classname( $product_id, $deprecated );
	} catch ( Exception $e ) {
		return false;
	}
}