Automattic\WooCommerce\Internal\CLI\Migrator\Core
WooCommerceProductImporter::create_product_object
Create appropriate product object based on type.
Метод класса: WooCommerceProductImporter{}
Хуков нет.
Возвращает
WC_Product|null. Product object or null on failure.
Использование
// private - только в коде основоного (родительского) класса $result = $this->create_product_object( $product_type ): ?WC_Product;
- $product_type(строка) (обязательный)
- Product type.
Код WooCommerceProductImporter::create_product_object() WooCommerceProductImporter::create product object WC 11.1.0
private function create_product_object( string $product_type ): ?WC_Product {
switch ( $product_type ) {
case 'variable':
return new WC_Product_Variable();
case 'simple':
default:
return new WC_Product_Simple();
}
}