PHP Class WC_Product_Factory

The WooCommerce product factory creating the right product object
Author: WooThemes
Show file Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
get_classname_from_product_type ( string $product_type ) : string | false Create a WC coding standards compliant class name e.g. WC_Product_Type_Class instead of WC_Product_type-class.
get_product ( mixed $product_id = false, array $deprecated = [] ) : WC_Product | boolean Get a product.
get_product_type ( integer $product_id ) : string | false Get the product type for a product.

Private Methods

Method Description
get_product_id ( mixed $product ) : integer | boolean Get the product ID depending on what was passed.

Method Details

get_classname_from_product_type() public static method

Create a WC coding standards compliant class name e.g. WC_Product_Type_Class instead of WC_Product_type-class.
public static get_classname_from_product_type ( string $product_type ) : string | false
$product_type string
return string | false

get_product() public method

Get a product.
public get_product ( mixed $product_id = false, array $deprecated = [] ) : WC_Product | boolean
$product_id mixed (default: false)
$deprecated array
return WC_Product | boolean Product object or null if the product cannot be loaded.

get_product_type() public static method

Get the product type for a product.
Since: 2.7.0
public static get_product_type ( integer $product_id ) : string | false
$product_id integer
return string | false