Automattic\WooCommerce\Internal\Abilities\Domain
ProductCreate::change
Set the product properties in memory.
Method of the class: ProductCreate{}
No Hooks.
Returns
null|\WP_Error.
Usage
$ProductCreate = new ProductCreate(); $ProductCreate->change( $subject, $input );
- $subject(WC_Product) (required)
- Product.
- $input(array) (required)
- Ability input.
ProductCreate::change() ProductCreate::change code 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 );
}
}