Automattic\WooCommerce\Blocks\AIContent

UpdateProducts::get_hash_for_product()publicWC 1.0

Return the hash for a product based on its name, description and image_id.

Method of the class: UpdateProducts{}

No Hooks.

Return

false|String.

Usage

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

UpdateProducts::get_hash_for_product() code WC 9.8.1

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

	return md5( $product->get_name() . $product->get_description() . $product->get_image_id() );
}