Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCTransactionalEmailPostsGenerator::compute_canonical_post_contentpublic staticWC 10.8.0

Compute the canonical post_content a given email.

Returns the post_content that the generator would persist for this email after the woocommerce_email_content_post_data runs, i.e. the exact string whose sha1 is stamped into _wc_email_template_source_hash.

Callers can hash the return value to obtain currentCoreHash for divergence detection.

Method of the class: WCTransactionalEmailPostsGenerator{}

No Hooks.

Returns

String. The canonical post content.

Usage

$result = WCTransactionalEmailPostsGenerator::compute_canonical_post_content( $email ): string;
$email(WC_Email) (required)
The transactional email instance.

Changelog

Since 10.8.0 Introduced.

WCTransactionalEmailPostsGenerator::compute_canonical_post_content() code WC 10.8.1

public static function compute_canonical_post_content( $email ): string {
	$post_data = self::build_filtered_post_data( (string) $email->id, $email );
	return (string) ( $post_data['post_content'] ?? '' );
}