Automattic\WooCommerce\Admin\API\AI

BusinessDescription::update_business_description()publicWC 1.0

Update the business description.

Method of the class: BusinessDescription{}

No Hooks.

Return

WP_REST_Response|WP_Error. Response object.

Usage

$BusinessDescription = new BusinessDescription();
$BusinessDescription->update_business_description( $request );
$request(WP_REST_Request) (required)
Request object.

BusinessDescription::update_business_description() code WC 9.4.2

public function update_business_description( $request ) {

	$business_description = $request->get_param( 'business_description' );

	if ( ! $business_description ) {
		return new WP_Error(
			'invalid_business_description',
			__( 'Invalid business description.', 'woocommerce' )
		);
	}

	update_option( 'last_business_description_with_ai_content_generated', $business_description );

	return rest_ensure_response(
		array(
			'ai_content_generated' => true,
		)
	);
}