wc_get_product_object( string $product_type, int $product_id )
Get a product object.
Contents
Description Description
See also See also
Parameters Parameters
- $product_type
-
(Required) Product type. If used an invalid type a WC_Product_Simple instance will be returned.
- $product_id
-
(Required) Product ID.
Return Return
Source Source
File: includes/wc-product-functions.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 ); }
Changelog Changelog
Version | Description |
---|---|
3.9.0 | Introduced. |