Introduced wc_get_product_classname function
This commit is contained in:
parent
0f28a61910
commit
24560f93bf
|
@ -64,6 +64,21 @@ function wc_get_product( $the_product = false, $deprecated = array() ) {
|
|||
return WC()->product_factory->get_product( $the_product, $deprecated );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product class name.
|
||||
*
|
||||
* @see WC_Product_Factory::get_product_classname
|
||||
* @since 3.9.0
|
||||
* @param string $product_type Product type.
|
||||
* @param int $product_id Product ID.
|
||||
* @return WC_Product
|
||||
*/
|
||||
function wc_get_product_classname( $product_type, $product_id = 0 ) {
|
||||
$classname = WC_Product_Factory::get_product_classname( $product_id, $product_type );
|
||||
|
||||
return new $classname();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not SKUS are enabled.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue