Automattic\WooCommerce\Blocks\AIContent

UpdateProducts::create_hash_for_ai_modified_product()publicWC 1.0

Create a hash with the AI-generated content and save it as a meta for the product.

Method of the class: UpdateProducts{}

No Hooks.

Return

true|false|Int.

Usage

$UpdateProducts = new UpdateProducts();
$UpdateProducts->create_hash_for_ai_modified_product( $product );
$product(\WC_Product) (required)
The product.

UpdateProducts::create_hash_for_ai_modified_product() code WC 9.8.1

public function create_hash_for_ai_modified_product( $product ) {
	if ( ! $product instanceof \WC_Product ) {
		return false;
	}

	$content = $this->get_hash_for_product( $product );

	return update_post_meta( $product->get_id(), '_ai_generated_content', $content );
}