Automattic\WooCommerce\Internal\Abilities\Domain

ProductCreate::change │ public │ WC 1.0

Set the product properties in memory.

Метод класса: ProductCreate{}

Хуков нет.

Возвращает

null|\WP_Error.

Использование

$ProductCreate = new ProductCreate();
$ProductCreate->change( $subject, $input );
$subject(WC_Product) (обязательный)
Product.
$input(массив) (обязательный)
Ability input.

Код ProductCreate::change() WC 11.3.0

public function change( $subject, array $input ) {
	$product_config = self::get_product_config_for_alias( $input['product_type_alias'] ?? 'physical' );

	if ( is_wp_error( $product_config ) ) {
		return $product_config;
	}

	try {
		self::apply_product_type_config( $subject, $product_config );

		return self::set_product_props_from_input( $subject, $input, $product_config );
	} catch ( \WC_Data_Exception $exception ) {
		return self::get_product_data_exception_error( $exception );
	}
}