WordPress at Your Fingertips
function is not described

wc_get_product_object() WC 3.9.0

Get a product object.

No Hooks.

Return

WC_Product.

Usage

wc_get_product_object( $product_type, $product_id );
$product_type(string) (required)
Product type. If used an invalid type a WC_Product_Simple instance will be returned.
$product_id(int)
Product ID.

Notes

  • See:

Changelog

Since 3.9.0 Introduced.

Code of wc_get_product_object() WC 5.5.2

<?php
function wc_get_product_object( $product_type, $product_id = 0 ) {
	$classname = WC_Product_Factory::get_product_classname( $product_id, $product_type );

	return new $classname( $product_id );
}